summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dcrt0.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-03-20 18:01:17 +0000
committerChristopher Faylor <me@cgf.cx>2006-03-20 18:01:17 +0000
commitc1494e03a2374c5841e7b53e0a97a3af7438cc76 (patch)
tree8b4ada17832554189880d5da736748cbfa9e9102 /winsup/cygwin/dcrt0.cc
parent4aedb2879609cd1c83b605d9470efdec9eedadd0 (diff)
downloadcygnal-c1494e03a2374c5841e7b53e0a97a3af7438cc76.tar.gz
cygnal-c1494e03a2374c5841e7b53e0a97a3af7438cc76.tar.bz2
cygnal-c1494e03a2374c5841e7b53e0a97a3af7438cc76.zip
* child_info.h (child_status): New enum.
(child_info::flag): Rename from 'straced'. (child_info::isstraced): New function. (child_info::iscygwin): Ditto. (child_info_fork::handle_fork): Reparmize. (child_info_fork::handle_failure): Ditto. (child_info_spawn::handle_spawn): New function. * dcrt0.cc (get_cygwin_startup_info): Use isstraced method. (child_info_spawn::handle_spawn): Define new function from code previously in dll_crt0_0. (dll_crt0_0): Move spawn stuff into handle_spawn. Only call init_console_handler for fork case. * sigproc.cc (child_info::child_info): Set flag appropriately. (child_info::proc_retry): Treat exit code as "funny" if it's a cygwin process. * spawn.cc (spawn_guts): Remove commented out flag setting.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r--winsup/cygwin/dcrt0.cc53
1 files changed, 29 insertions, 24 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index de01d7435..0518ac28f 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -622,7 +622,7 @@ get_cygwin_startup_info ()
multiple_cygwin_problem ("proc size", res->cb, should_be_cb);
else if (sizeof (fhandler_union) != res->fhandler_union_cb)
multiple_cygwin_problem ("fhandler size", res->fhandler_union_cb, sizeof (fhandler_union));
- if (res->straced)
+ if (res->isstraced ())
{
res->ready (false);
for (unsigned i = 0; !being_debugged () && i < 10000; i++)
@@ -669,6 +669,33 @@ child_info_fork::handle_fork ()
api_fatal ("recreate_mmaps_after_fork_failed");
}
+void
+child_info_spawn::handle_spawn ()
+{
+ HANDLE h;
+ cygheap_fixup_in_child (true);
+ memory_init ();
+ if (!moreinfo->myself_pinfo ||
+ !DuplicateHandle (hMainProc, moreinfo->myself_pinfo, hMainProc, &h, 0,
+ FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
+ h = NULL;
+ set_myself (h);
+ ready (true);
+ __argc = moreinfo->argc;
+ __argv = moreinfo->argv;
+ envp = moreinfo->envp;
+ envc = moreinfo->envc;
+ if (!dynamically_loaded)
+ cygheap->fdtab.fixup_after_exec ();
+ signal_fixup_after_exec ();
+ if (moreinfo->old_title)
+ {
+ old_title = strcpy (title_buf, moreinfo->old_title);
+ cfree (moreinfo->old_title);
+ }
+ init_console_handler (myself->ctty >= 0);
+}
+
void __stdcall
dll_crt0_0 ()
{
@@ -718,31 +745,9 @@ dll_crt0_0 ()
break;
case _PROC_SPAWN:
case _PROC_EXEC:
- HANDLE h;
- cygheap_fixup_in_child (true);
- memory_init ();
- if (!spawn_info->moreinfo->myself_pinfo ||
- !DuplicateHandle (hMainProc, spawn_info->moreinfo->myself_pinfo,
- hMainProc, &h, 0, FALSE,
- DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
- h = NULL;
- set_myself (h);
- child_proc_info->ready (true);
- __argc = spawn_info->moreinfo->argc;
- __argv = spawn_info->moreinfo->argv;
- envp = spawn_info->moreinfo->envp;
- envc = spawn_info->moreinfo->envc;
- if (!dynamically_loaded)
- cygheap->fdtab.fixup_after_exec ();
- signal_fixup_after_exec ();
- if (spawn_info->moreinfo->old_title)
- {
- old_title = strcpy (title_buf, spawn_info->moreinfo->old_title);
- cfree (spawn_info->moreinfo->old_title);
- }
+ spawn_info->handle_spawn ();
break;
}
- init_console_handler (myself->ctty >= 0);
}
user_data->resourcelocks->Init ();