rbb 99/12/13 12:42:22
Modified: src/lib/apr/include apr_lib.h apr_pools.h src/lib/apr/lib apr_pools.c Log: Fi ap_note_subprocess to use ap_proc_t's instead of pid's. Revision Changes Path 1.21 +2 -1 apache-2.0/src/lib/apr/include/apr_lib.h Index: apr_lib.h =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_lib.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- apr_lib.h 1999/12/01 20:35:34 1.20 +++ apr_lib.h 1999/12/13 20:42:02 1.21 @@ -66,6 +66,7 @@ #include "apr_general.h" #include "apr_file_io.h" +#include "apr_thread_proc.h" #if APR_HAVE_STDARG_H #include <stdarg.h> @@ -353,7 +354,7 @@ API_EXPORT(ap_status_t) ap_getpass(const char *prompt, char *pwbuf, size_t *bufsize); API_EXPORT_NONSTD(ap_status_t) ap_null_cleanup(void *data); -API_EXPORT(void) ap_note_subprocess(struct context_t *a, pid_t pid, +API_EXPORT(void) ap_note_subprocess(struct context_t *a, ap_proc_t *pid, enum kill_conditions how); API_EXPORT(int) ap_spawn_child(ap_context_t *p, 1.8 +1 -14 apache-2.0/src/lib/apr/include/apr_pools.h Index: apr_pools.h =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_pools.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- apr_pools.h 1999/12/01 20:35:39 1.7 +++ apr_pools.h 1999/12/13 20:42:05 1.8 @@ -90,7 +90,7 @@ #endif struct process_chain { - pid_t pid; + ap_proc_t *pid; enum kill_conditions kill_how; struct process_chain *next; }; @@ -241,19 +241,6 @@ */ #define ap_table_elts(t) ((ap_array_header_t *)(t)) #define ap_is_empty_table(t) (((t) == NULL)||(((ap_array_header_t *)(t))->nelts == 0)) - -/* ... even child processes (which we may want to wait for, - * or to kill outright, on unexpected termination). - * - * ap_spawn_child is a utility routine which handles an awful lot of - * the rigamarole associated with spawning a child --- it arranges - * for pipes to the child's stdin and stdout, if desired (if not, - * set the associated args to NULL). It takes as args a function - * to call in the child, and an argument to be passed to the function. - */ - -API_EXPORT(void) ap_note_subprocess(struct context_t *a, pid_t pid, - enum kill_conditions how); /* magic numbers --- min free bytes to consider a free ap_context_t block useable, * and the min amount to allocate if we have to go to malloc() */ 1.29 +6 -6 apache-2.0/src/lib/apr/lib/apr_pools.c Index: apr_pools.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_pools.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- apr_pools.c 1999/12/09 21:00:43 1.28 +++ apr_pools.c 1999/12/13 20:42:18 1.29 @@ -1216,7 +1216,7 @@ * generic interface, but for now, it's a special case */ -API_EXPORT(void) ap_note_subprocess(struct context_t *a, pid_t pid, +API_EXPORT(void) ap_note_subprocess(struct context_t *a, ap_proc_t *pid, enum kill_conditions how) { struct process_chain *new = @@ -1304,7 +1304,7 @@ #ifndef NEED_WAITPID /* Pick up all defunct processes */ for (p = procs; p; p = p->next) { - if (waitpid(p->pid, (int *) 0, WNOHANG) > 0) { + if (ap_wait_proc(p->pid, APR_NOWAIT) > 0) { p->kill_how = kill_never; } } @@ -1316,12 +1316,12 @@ /* * Subprocess may be dead already. Only need the timeout if not. */ - if (kill(p->pid, SIGTERM) != -1) { + if (ap_kill(p->pid, SIGTERM) != -1) { need_timeout = 1; } } else if (p->kill_how == kill_always) { - kill(p->pid, SIGKILL); + ap_kill(p->pid, SIGKILL); } } @@ -1339,11 +1339,11 @@ for (p = procs; p; p = p->next) { if (p->kill_how == kill_after_timeout) { - kill(p->pid, SIGKILL); + ap_kill(p->pid, SIGKILL); } if (p->kill_how != kill_never) { - waitpid(p->pid, &status, 0); + status = ap_wait_proc(p->pid, APR_WAIT); } } #endif /* WIN32 */