summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-12-27 00:35:19 +0000
committerChristopher Faylor <me@cgf.cx>2004-12-27 00:35:19 +0000
commit445d5ce8fcffed71f4349c723b707dc779fe1cc2 (patch)
treedd0a5b737917fddf83d4a9a38b947126cf8ddfad
parent8711eddd80efc5f05f19da613ce3ad7ebc66aa35 (diff)
downloadcygnal-445d5ce8fcffed71f4349c723b707dc779fe1cc2.tar.gz
cygnal-445d5ce8fcffed71f4349c723b707dc779fe1cc2.tar.bz2
cygnal-445d5ce8fcffed71f4349c723b707dc779fe1cc2.zip
* init.cc (dll_entry): Remove exit code setting.
* pinfo.cc (pinfo::init): Initialize exitcode to unset state rather than SIGTERM. (proc_waiter): Detect if exit code is unset and use status from GetExitCodeProcess. * sigproc.cc (child_info::sync): Remove exit code detection here since proc_waiter now (again) detects it.
-rw-r--r--winsup/cygwin/ChangeLog10
-rw-r--r--winsup/cygwin/init.cc3
-rw-r--r--winsup/cygwin/pinfo.cc8
-rw-r--r--winsup/cygwin/pinfo.h2
-rw-r--r--winsup/cygwin/sigproc.cc7
5 files changed, 19 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4ae5c13df..be0e65fed 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,13 @@
+2004-12-26 Christopher Faylor <cgf@timesys.com>
+
+ * init.cc (dll_entry): Remove exit code setting.
+ * pinfo.cc (pinfo::init): Initialize exitcode to unset state rather
+ than SIGTERM.
+ (proc_waiter): Detect if exit code is unset and use status from
+ GetExitCodeProcess.
+ * sigproc.cc (child_info::sync): Remove exit code detection here since
+ proc_waiter now (again) detects it.
+
2004-12-25 Christopher Faylor <cgf@timesys.com>
* fhandler.cc (fhandler_base::fchmod): Do the right thing when changing
diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc
index 261b20b4d..7ba0dc348 100644
--- a/winsup/cygwin/init.cc
+++ b/winsup/cygwin/init.cc
@@ -13,7 +13,6 @@ details. */
#include "thread.h"
#include "perprocess.h"
#include "cygtls.h"
-#include "pinfo.h"
int NO_COPY dynamically_loaded;
static char *search_for = (char *) cygthread::stub;
@@ -127,8 +126,6 @@ dll_entry (HANDLE h, DWORD reason, void *static_load)
dll_crt0_0 ();
break;
case DLL_PROCESS_DETACH:
- if (myself)
- myself->exitcode = 1 << 8;
break;
case DLL_THREAD_ATTACH:
munge_threadfunc ();
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 1bf6b5ea3..24167b90d 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -265,7 +265,7 @@ pinfo::init (pid_t n, DWORD flag, HANDLE in_h)
else if (!(flag & PID_EXECED))
{
procinfo->pid = n;
- procinfo->exitcode = SIGTERM;
+ procinfo->exitcode = EXITCODE_UNSET;
}
else
{
@@ -702,6 +702,12 @@ proc_waiter (void *arg)
/* Child exited. Do some cleanup and signal myself. */
CloseHandle (vchild.rd_proc_pipe);
vchild.rd_proc_pipe = NULL;
+ if (vchild->exitcode == EXITCODE_UNSET)
+ {
+ DWORD x;
+ GetExitCodeProcess (vchild.hProcess, &x);
+ vchild->exitcode = (x & 0xff) << 8;
+ }
if (WIFEXITED (vchild->exitcode))
si.si_sigval.sival_int = CLD_EXITED;
else if (WCOREDUMP (vchild->exitcode))
diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h
index dd998a649..b649e0fbd 100644
--- a/winsup/cygwin/pinfo.h
+++ b/winsup/cygwin/pinfo.h
@@ -26,6 +26,8 @@ enum picom
PICOM_FIFO = 2
};
+#define EXITCODE_UNSET 0x80000000
+
class _pinfo
{
public:
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index b5a281530..db4997b88 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -798,13 +798,6 @@ child_info::sync (pinfo& vchild, DWORD howlong)
case WAIT_OBJECT_0 + 1:
if (WaitForSingleObject (subproc_ready, 0) == WAIT_OBJECT_0)
sigproc_printf ("should never happen. noticed subproc_ready after process exit");
- else
- {
- DWORD exitcode = 0;
- (void) GetExitCodeProcess (vchild.hProcess, &exitcode);
- vchild->exitcode = (exitcode & 0xff) << 8;
- sigproc_printf ("non-cygwin exit value is %p", exitcode);
- }
res = false;
break;
default: