summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dcrt0.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-01-23 23:05:33 +0000
committerChristopher Faylor <me@cgf.cx>2004-01-23 23:05:33 +0000
commitf723909038afc7657b5a19c48d64458ad0dd18d8 (patch)
tree42581fecc70aca8fff333f8e7808fab4400a6b2b /winsup/cygwin/dcrt0.cc
parent7dddf53f5caee354852156ce552859c0bc81a3c7 (diff)
downloadcygnal-f723909038afc7657b5a19c48d64458ad0dd18d8.tar.gz
cygnal-f723909038afc7657b5a19c48d64458ad0dd18d8.tar.bz2
cygnal-f723909038afc7657b5a19c48d64458ad0dd18d8.zip
* configure.in: Remove NEWVFORK default.
* configure: Regenerate. * dcrt0.cc: Conditionalize vfork stuff throughout. * dtable.cc: Ditto. * perthread.h: Ditto. * pipe.cc (fhandler_pipe::close): Ditto. * spawn.cc (spawnve): Ditto. * syscalls.cc (setsid): Ditto. * exceptions.cc (sigpacket::process): Use macro to refer to vfork pid. * debug.cc (verify_handle): Define new function. * debug.h (VerifyHandle): Define new macro. (verify_handle): Declare new function * fhandler.cc (fhandler_base::dup): Verify that dup'ed handle is not supposed to be in use. (fhandler_base::set_inheritance): Ditto. (fhandler_base::fork_fixup): Ditto. * fhandler_socket.cc (fhandler_socket::dup): Ditto. * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. * net.cc (set_socket_inheritance): Ditto. * pinfo.cc (pinfo_fixup_after_exec): Ditto. * sigproc.cc (proc_subproc): Ditto. (sig_send): Ditto. * spawn.cc (spawn_guts): Ditto. * thread.cc (pthread::init_mainthread): Ditto. * pipe.cc (fhandler_pipe::close): Close read_state with ForceCloseHandle since it was protected. (fhandler_pipe::fixup_after_exec): Protect read_state handle. (fhandler_pipe::dup): Correctly close open handles on error condition. Verify that dup'ed handle is not supposed to be in use. (fhandler_pipe::create): Protect read_state.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r--winsup/cygwin/dcrt0.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 37e52a996..6a08261c1 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -45,10 +45,14 @@ HANDLE NO_COPY hMainProc = (HANDLE) -1;
HANDLE NO_COPY hMainThread;
per_thread_waitq NO_COPY waitq_storage;
+#ifdef NEWVFORK
per_thread_vfork NO_COPY vfork_storage;
+#endif
per_thread NO_COPY *threadstuff[] = {&waitq_storage,
+#ifdef NEWVFORK
&vfork_storage,
+#endif
NULL};
bool display_title;
@@ -59,7 +63,9 @@ codepage_type current_codepage = ansi_cp;
int __argc_safe;
int _declspec(dllexport) __argc;
char _declspec(dllexport) **__argv;
+#ifdef NEWVFORK
vfork_save NO_COPY *main_vfork;
+#endif
static int NO_COPY envc;
char NO_COPY **envp;
@@ -764,9 +770,10 @@ dll_crt0_1 (char *)
Need to do this before any helper threads start. */
debug_init ();
+#ifdef NEWVFORK
cygheap->fdtab.vfork_child_fixup ();
-
main_vfork = vfork_storage.create ();
+#endif
cygbench ("pre-forkee");
if (user_data->forkee)
@@ -993,12 +1000,14 @@ do_exit (int status)
{
syscall_printf ("do_exit (%d), exit_state %d", status, exit_state);
+#ifdef NEWVFORK
vfork_save *vf = vfork_storage.val ();
if (vf != NULL && vf->pid < 0)
{
exit_state = ES_NOT_EXITING;
vf->restore_exit (status);
}
+#endif
EnterCriticalSection (&exit_lock);
muto::set_exiting_thread ();