summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/apr_lib.h3
-rw-r--r--include/apr_pools.h15
-rw-r--r--lib/apr_pools.c12
-rw-r--r--memory/unix/apr_pools.c12
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 */