Name

ap_bspawn_child — spawn a child process

Synopsis

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 BUFFs 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.

Get Apache: The Definitive Guide, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.