summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dcrt0.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-01-11 15:31:04 +0000
committerChristopher Faylor <me@cgf.cx>2005-01-11 15:31:04 +0000
commit2380dfe14ca24fcc7ddb63feb8f7e4958c1a76ea (patch)
tree38221c0ab6a47ce8876b141458489586a7a6b635 /winsup/cygwin/dcrt0.cc
parentaa67a4484ee30a61d1d12da8209308ab691f6bba (diff)
downloadcygnal-2380dfe14ca24fcc7ddb63feb8f7e4958c1a76ea.tar.gz
cygnal-2380dfe14ca24fcc7ddb63feb8f7e4958c1a76ea.tar.bz2
cygnal-2380dfe14ca24fcc7ddb63feb8f7e4958c1a76ea.zip
* 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.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r--winsup/cygwin/dcrt0.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index b5ce6d53d..df639c20f 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -625,12 +625,8 @@ dll_crt0_0 ()
else if (sizeof (fhandler_union) != child_proc_info->fhandler_union_cb)
multiple_cygwin_problem ("fhandler size", child_proc_info->fhandler_union_cb, sizeof (fhandler_union));
else
- {
- if (child_proc_info->type != _PROC_FORK)
- child_proc_info->ready (true);
- cygwin_user_h = child_proc_info->user_h;
- break;
- }
+ cygwin_user_h = child_proc_info->user_h;
+ break;
default:
system_printf ("unknown exec type %d", child_proc_info->type);
/* intentionally fall through */
@@ -667,6 +663,8 @@ dll_crt0_0 ()
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
h = NULL;
set_myself (h);
+ if (child_proc_info->type != _PROC_FORK)
+ child_proc_info->ready (true);
__argc = spawn_info->moreinfo->argc;
__argv = spawn_info->moreinfo->argv;
envp = spawn_info->moreinfo->envp;
@@ -1060,7 +1058,7 @@ do_exit (int status)
}
minimal_printf ("winpid %d, exit %d", GetCurrentProcessId (), n);
- myself->exit (n);
+ myself.exit (n);
}
static muto *atexit_lock;
@@ -1123,7 +1121,7 @@ __api_fatal (const char *fmt, ...)
#ifdef DEBUGGING
(void) try_to_debug ();
#endif
- myself->exit (1);
+ myself.exit (1);
}
void