FileDocCategorySizeDatePackage
Proc.javaAPI DocApache Tomcat 6.0.149373Fri Jul 20 04:20:36 BST 2007org.apache.tomcat.jni

Proc

public class Proc extends Object
Proc
author
Mladen Turk
version
$Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $

Fields Summary
public static final int
APR_SHELLCM
public static final int
APR_PROGRAM
use the shell to invoke the program
public static final int
APR_PROGRAM_ENV
invoke the program directly, no copied env
public static final int
APR_PROGRAM_PATH
invoke the program, replicating our environment
public static final int
APR_SHELLCMD_ENV
find program on PATH, use our environment
public static final int
APR_WAIT
use the shell to invoke the program, replicating our environment
public static final int
APR_NOWAIT
wait for the specified process to finish
public static final int
APR_PROC_EXIT
do not wait -- just see if it has finished
public static final int
APR_PROC_SIGNAL
process exited normally
public static final int
APR_PROC_SIGNAL_CORE
process exited due to a signal
public static final int
APR_NO_PIPE
process exited and dumped a core file
public static final int
APR_FULL_BLOCK
public static final int
APR_FULL_NONBLOCK
public static final int
APR_PARENT_BLOCK
public static final int
APR_CHILD_BLOCK
public static final int
APR_LIMIT_CPU
public static final int
APR_LIMIT_MEM
public static final int
APR_LIMIT_NPROC
public static final int
APR_LIMIT_NOFILE
public static final int
APR_OC_REASON_DEATH
child has died, caller must call unregister still
public static final int
APR_OC_REASON_UNWRITABLE
write_fd is unwritable
public static final int
APR_OC_REASON_RESTART
a restart is occuring, perform any necessary cleanup (including sending a special signal to child)
public static final int
APR_OC_REASON_UNREGISTER
unregister has been called, do whatever is necessary (including kill the child)
public static final int
APR_OC_REASON_LOST
somehow the child exited without us knowing ... buggy os?
public static final int
APR_OC_REASON_RUNNING
a health check is occuring, for most maintainence functions this is a no-op.
public static final int
APR_KILL_NEVER
process is never sent any signals
public static final int
APR_KILL_ALWAYS
process is sent SIGKILL on apr_pool_t cleanup
public static final int
APR_KILL_AFTER_TIMEOUT
SIGTERM, wait 3 seconds, SIGKILL
public static final int
APR_JUST_WAIT
wait forever for the process to complete
public static final int
APR_KILL_ONLY_ONCE
send SIGTERM and then wait
public static final int
APR_PROC_DETACH_FOREGROUND
public static final int
APR_PROC_DETACH_DAEMONIZE
Do not detach
public static final int
MAX_ARGS_SIZE
Detach
public static final int
MAX_ENV_SIZE
Constructors Summary
Methods Summary
public static native longalloc(long cont)
Allocate apr_proc_t stucture from pool This is not an apr function.

param
cont The pool to use.

public static native intcreate(long proc, java.lang.String progname, java.lang.String[] args, java.lang.String[] env, long attr, long pool)
Create a new process and execute a new program within that process. This function returns without waiting for the new process to terminate; use apr_proc_wait for that.

param
progname The program to run
param
args The arguments to pass to the new program. The first one should be the program name.
param
env The new environment table for the new process. This should be a list of NULL-terminated strings. This argument is ignored for APR_PROGRAM_ENV, APR_PROGRAM_PATH, and APR_SHELLCMD_ENV types of commands.
param
attr The procattr we should use to determine how to create the new process
param
pool The pool to use.
return
The resulting process handle.

public static native intdetach(int daemonize)
Detach the process from the controlling terminal.

param
daemonize set to non-zero if the process should daemonize and become a background process, else it will stay in the foreground.

public static native intfork(long[] proc, long cont)
This is currently the only non-portable call in APR. This executes a standard unix fork.

param
proc The resulting process handle.
param
cont The pool to use.
return
APR_INCHILD for the child, and APR_INPARENT for the parent or an error.

public static native intkill(long proc, int sig)
Terminate a process.

param
proc The process to terminate.
param
sig How to kill the process.

public static native intwait(long proc, int[] exit, int waithow)
Wait for a child process to die

param
proc The process handle that corresponds to the desired child process
param
exit exit[0] The returned exit status of the child, if a child process dies, or the signal that caused the child to die. On platforms that don't support obtaining this information, the status parameter will be returned as APR_ENOTIMPL. exit[1] Why the child died, the bitwise or of:
APR_PROC_EXIT -- process terminated normally
APR_PROC_SIGNAL -- process was killed by a signal
APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
generated a core dump.
param
waithow How should we wait. One of:
APR_WAIT -- block until the child process dies.
APR_NOWAIT -- return immediately regardless of if the
child is dead or not.
return
The childs status is in the return code to this process. It is one of:
APR_CHILD_DONE -- child is no longer running.
APR_CHILD_NOTDONE -- child is still running.

public static native intwaitAllProcs(long proc, int[] exit, int waithow, long pool)
Wait for any current child process to die and return information about that child.

param
proc Pointer to NULL on entry, will be filled out with child's information
param
exit exit[0] The returned exit status of the child, if a child process dies, or the signal that caused the child to die. On platforms that don't support obtaining this information, the status parameter will be returned as APR_ENOTIMPL. exit[1] Why the child died, the bitwise or of:
APR_PROC_EXIT -- process terminated normally
APR_PROC_SIGNAL -- process was killed by a signal
APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
generated a core dump.
param
waithow How should we wait. One of:
APR_WAIT -- block until the child process dies.
APR_NOWAIT -- return immediately regardless of if the
child is dead or not.
param
pool Pool to allocate child information out of.