diff options
author | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 1999-12-13 20:42:18 +0000 |
---|---|---|
committer | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 1999-12-13 20:42:18 +0000 |
commit | c2b1802714acb0247d67ded3e9f12952190c167d (patch) | |
tree | 5db7a0dc060e93bdadf38d74e268f914e9fa1ef0 | |
parent | a531d7df74a7612b82636ed4cbd7300ab0e12b93 (diff) | |
download | libapr-c2b1802714acb0247d67ded3e9f12952190c167d.tar.gz |
Fi ap_note_subprocess to use ap_proc_t's instead of pid's.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59518 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | include/apr_lib.h | 3 | ||||
-rw-r--r-- | include/apr_pools.h | 15 | ||||
-rw-r--r-- | lib/apr_pools.c | 12 | ||||
-rw-r--r-- | memory/unix/apr_pools.c | 12 |
4 files changed, 15 insertions, 27 deletions
diff --git a/include/apr_lib.h b/include/apr_lib.h index 637a4b642..84da11203 100644 --- a/include/apr_lib.h +++ b/include/apr_lib.h @@ -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(void) ap_cleanup_for_exec(void); 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, diff --git a/include/apr_pools.h b/include/apr_pools.h index 05202d819..603bb79ed 100644 --- a/include/apr_pools.h +++ b/include/apr_pools.h @@ -90,7 +90,7 @@ extern "C" { #endif struct process_chain { - pid_t pid; + ap_proc_t *pid; enum kill_conditions kill_how; struct process_chain *next; }; @@ -242,19 +242,6 @@ extern int raise_sigstop_flags; #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() */ diff --git a/lib/apr_pools.c b/lib/apr_pools.c index faca265bf..123da89d1 100644 --- a/lib/apr_pools.c +++ b/lib/apr_pools.c @@ -1216,7 +1216,7 @@ API_EXPORT_NONSTD(ap_status_t) ap_null_cleanup(void *data) * 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 @@ static void free_proc_chain(struct process_chain *procs) #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 @@ static void free_proc_chain(struct process_chain *procs) /* * 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 @@ static void free_proc_chain(struct process_chain *procs) 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 */ diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c index faca265bf..123da89d1 100644 --- a/memory/unix/apr_pools.c +++ b/memory/unix/apr_pools.c @@ -1216,7 +1216,7 @@ API_EXPORT_NONSTD(ap_status_t) ap_null_cleanup(void *data) * 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 @@ static void free_proc_chain(struct process_chain *procs) #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 @@ static void free_proc_chain(struct process_chain *procs) /* * 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 @@ static void free_proc_chain(struct process_chain *procs) 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 */ |