ap_bspawn_child — spawn a child process
int ap_bspawn_child(pool *p, int (*func) (void *, child_info *), void *data, enum kill_conditions kill_how, BUFF **pipe_in, BUFF **pipe_out, BUFF **pipe_err)
Spawns a child process with pipes optionally connected to its
standard input, output, and error. This function takes care of the
details of forking (if the platform supports it) and setting up the
pipes. func
is called with data
and a child_info
structure as its arguments in the
child process. The child_info
structure carries
information needed to spawn the child under Win32; it is normally
passed straight on to ap_call_exec()
. If
func()
wants cleanup to occur, it calls
cleanup_for_exec
. func()
will
normally execute the child process with ap_call_exec(
)
. If any of pipe_in
,
pipe_out
, or pipe_err
are
NULL
, those pipes aren’t created;
otherwise, they are filled in with pointers to
BUFF
s that are connected to the
subprocesses’ standard input, output, and error,
respectively. Note that on Win32, the pipes use Win32 native handles
rather than C-file handles. This function only returns in the parent.
Returns the PID of the child process or -1
on
error. This function was called
spawn_child_err_buff
in previous versions of
Apache.