302 }
303 return get(ppid);
304 }
305
306 /**
307 * Returns the parent of the native pid argument.
308 *
309 * @param pid the process id
310 * @param startTime the startTime of the process
311 * @return the parent of the native pid; if any, otherwise -1
312 */
313 private static native long parent0(long pid, long startTime);
314
315 /**
316 * Returns the number of pids filled in to the array.
317 * @param pid if {@code pid} equals zero, then all known processes are returned;
318 * otherwise only direct child process pids are returned
319 * @param pids an allocated long array to receive the pids
320 * @param ppids an allocated long array to receive the parent pids; may be null
321 * @param starttimes an allocated long array to receive the child start times; may be null
322 * @return if greater than or equals to zero is the number of pids in the array;
323 * if greater than the length of the arrays, the arrays are too small
324 */
325 private static native int getProcessPids0(long pid, long[] pids,
326 long[] ppids, long[] starttimes);
327
328 /**
329 * Destroy the process for this ProcessHandle.
330 * The native code checks the start time before sending the termination request.
331 *
332 * @param force {@code true} if the process should be terminated forcibly;
333 * else {@code false} for a normal termination
334 */
335 boolean destroyProcess(boolean force) {
336 if (this.equals(current)) {
337 throw new IllegalStateException("destroy of current process not allowed");
338 }
339 return destroy0(pid, startTime, force);
340 }
341
342 /**
|
302 }
303 return get(ppid);
304 }
305
306 /**
307 * Returns the parent of the native pid argument.
308 *
309 * @param pid the process id
310 * @param startTime the startTime of the process
311 * @return the parent of the native pid; if any, otherwise -1
312 */
313 private static native long parent0(long pid, long startTime);
314
315 /**
316 * Returns the number of pids filled in to the array.
317 * @param pid if {@code pid} equals zero, then all known processes are returned;
318 * otherwise only direct child process pids are returned
319 * @param pids an allocated long array to receive the pids
320 * @param ppids an allocated long array to receive the parent pids; may be null
321 * @param starttimes an allocated long array to receive the child start times; may be null
322 * @return if greater than or equal to zero is the number of pids in the array;
323 * if greater than the length of the arrays, the arrays are too small
324 */
325 private static native int getProcessPids0(long pid, long[] pids,
326 long[] ppids, long[] starttimes);
327
328 /**
329 * Destroy the process for this ProcessHandle.
330 * The native code checks the start time before sending the termination request.
331 *
332 * @param force {@code true} if the process should be terminated forcibly;
333 * else {@code false} for a normal termination
334 */
335 boolean destroyProcess(boolean force) {
336 if (this.equals(current)) {
337 throw new IllegalStateException("destroy of current process not allowed");
338 }
339 return destroy0(pid, startTime, force);
340 }
341
342 /**
|