diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2003-02-24 23:27:14 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2003-02-24 23:27:14 +0000 |
commit | 5ff5c89466367e6970c054383487162bed66ae3a (patch) | |
tree | 62dadf0fd9d6e6ce127b821f7d5f940739177bd0 /threadproc/win32 | |
parent | 6a05818c64f1ad2bd8ababeea7089db0dbb1f3e3 (diff) | |
download | libapr-5ff5c89466367e6970c054383487162bed66ae3a.tar.gz |
Our exit codes are ugly, this should help some of them and tell us what
sort of exit occurred.
Declare apr_proc_wait_all_procs() unimplemented, and further fix the
code not to shut down the ->hproc which we need to recover the error
in the otherchild logic.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64381 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/win32')
-rw-r--r-- | threadproc/win32/proc.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c index 02b6f57f0..9f13d6e7a 100644 --- a/threadproc/win32/proc.c +++ b/threadproc/win32/proc.c @@ -692,6 +692,31 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, return APR_SUCCESS; } +APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, + int *exitcode, + apr_exit_why_e *exitwhy, + apr_wait_how_e waithow, + apr_pool_t *p) +{ + /* Unix does apr_proc_wait(proc(-1), exitcode, exitwhy, waithow) + * but Win32's apr_proc_wait won't work that way. + */ + return APR_ENOTIMPL; +} + +static apr_exit_why_e why_from_exit_code(DWORD exit) { + /* See WinNT.h STATUS_ACCESS_VIOLATION and family for how + * this class of failures was determined + */ + if (((exit & 0xC0000000) == 0xC0000000) + && !(exit & 0x3FFF0000)) + return APR_PROC_SIGNAL; + else + return APR_PROC_EXIT; + + /* ### No way to tell if Dr Watson grabbed a core, AFAICT. */ +} + APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, int *exitcode, apr_exit_why_e *exitwhy, apr_wait_how_e waithow) @@ -699,9 +724,6 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, DWORD stat; DWORD time; - if (!proc) - return APR_ENOPROC; - if (waithow == APR_WAIT) time = INFINITE; else @@ -710,9 +732,9 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, if ((stat = WaitForSingleObject(proc->hproc, time)) == WAIT_OBJECT_0) { if (GetExitCodeProcess(proc->hproc, &stat)) { if (exitcode) - *exitcode = (apr_wait_t)stat; - CloseHandle(proc->hproc); - proc->hproc = NULL; + *exitcode = stat; + if (exitwhy) + *exitwhy = why_from_exit_code(stat); return APR_CHILD_DONE; } } |