* pinfo.h (_pinfo::set_exit_state): Declare new function.

(pinfo::exit): Move here from _pinfo::exit.
* sigproc.cc (child_info::sync): Use new function to set exitcode and
process_state.
* pinfo.cc (_pinfo::exit): Ditto.
(proc_waiter): Ditto.
(_pinfo::set_exit_state): Define new function.
(_pinfo::dup_proc_pipe): Close handle when there is no parent process around to
care about the exit value.
* dcrt0.cc (dll_crt0_0): Move subproc_ready synchronization later to make sure
that myself is still mapped in parent.
(do_exit): Reflect movement to pinfo::exit.
(__api_fatal): Ditto.
* exceptions.cc (signal_exit): Ditto.
* errno.cc (errmap): Map PROC_NOT_FOUND.
* init.cc (dll_entry): Release myself before exiting.
* sigproc.cc (proc_can_be_signalled): Set errno appropriately.
(sig_send): Ditto.  Also remove ill-advised test for !myself->sendsig since
this is an indication of a process which is still initializating -- it is not
an error.
(child_info::sync): Don't set exitcode here.  Assume that will happen in
proc_waiter, if necessary.
* spawn.cc (spawn_guts): Delay "wait_for_myself" logic until later.  Don't wait
at all if the process has already exited.  Reflect movement to pinfo::exit.
This commit is contained in:
Christopher Faylor
2005-01-11 15:31:04 +00:00
parent aa67a4484e
commit 2380dfe14c
10 changed files with 149 additions and 100 deletions

View File

@ -111,6 +111,7 @@ extern "C" int WINAPI
dll_entry (HANDLE h, DWORD reason, void *static_load)
{
BOOL is_64bit_machine = FALSE;
extern HANDLE hExeced;
switch (reason)
{
@ -127,8 +128,12 @@ dll_entry (HANDLE h, DWORD reason, void *static_load)
dll_crt0_0 ();
break;
case DLL_PROCESS_DETACH:
if (myself && myself->exitcode == EXITCODE_UNSET)
myself->exitcode = 1 << 8;
if (myself)
{
if (!hExeced && myself->exitcode == EXITCODE_UNSET)
myself->exitcode = 1 << 8;
myself.release ();
}
break;
case DLL_THREAD_ATTACH:
munge_threadfunc ();