summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dcrt0.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-11-14 05:53:32 +0000
committerChristopher Faylor <me@cgf.cx>2000-11-14 05:53:32 +0000
commita4785603b85b80ea0cc5ea0038bbbb3a13513714 (patch)
tree3bb9ab5f76acbe2fbca946b6c4f9439a8aa42c58 /winsup/cygwin/dcrt0.cc
parent70a11195b9bf3617e3dbe4b9de034b3792c65621 (diff)
downloadcygnal-a4785603b85b80ea0cc5ea0038bbbb3a13513714.tar.gz
cygnal-a4785603b85b80ea0cc5ea0038bbbb3a13513714.tar.bz2
cygnal-a4785603b85b80ea0cc5ea0038bbbb3a13513714.zip
* cygheap.h (init_cygheap): New struct holding values that live in the Cygwin
heap. * child_info.h (child_info): Change pointer type of cygheap to init_cygheap. * cygheap.cc (init_cheap): Point cygheap_max after contents of cygheap. Move some stuff into cygheap.h. * dir.cc (opendir): Change to use root and rootlen in cygheap rather than in myself. (mkdir): Change to use umask in cygheap rather than in myself. * path.cc: Ditto, throughout. * syscalls.cc (_open): Ditto. Change to use umask in cygheap rather than in myself. (chroot): Change to allocate root dir on the cygwin heap. (umask): Change to use umask in cygheap rather than in myself. (cygwin_bind): Ditto. * sigproc.cc (proc_subproc): Don't copy umask or root stuff as this happens automatically now. * pinfo.h (_pinfo): Migrate stuff out of here and into init_cheap. * dcrt0.cc (dll_crt0_1): Call cygheap_init later in startup for first cygwin process.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r--winsup/cygwin/dcrt0.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 8682685b5..7f75eca8f 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -654,7 +654,6 @@ dll_crt0_1 ()
threadname_init ();
debug_init ();
- cygheap_init (); /* Initialize cygheap muto */
regthread ("main", GetCurrentThreadId ());
mainthread.init ("mainthread"); // For use in determining if signals
@@ -734,6 +733,9 @@ dll_crt0_1 ()
/* Initialize events. */
events_init ();
+ if (!child_proc_info)
+ cygheap_init ();
+
cygcwd.init ();
cygbench ("pre-forkee");
@@ -861,14 +863,6 @@ dll_crt0_1 ()
extern "C" void __stdcall
_dll_crt0 ()
{
- char zeros[sizeof (fork_info->zero)] = {0};
-#ifdef DEBUGGING
- strace.microseconds ();
-#endif
-
- /* Set the os_being_run global. */
- set_os_type ();
-
#ifdef DEBUGGING
char buf[80];
if (GetEnvironmentVariable ("CYGWIN_SLEEP", buf, sizeof (buf)))
@@ -878,7 +872,16 @@ _dll_crt0 ()
}
#endif
+ char zeros[sizeof (fork_info->zero)] = {0};
+#ifdef DEBUGGING
+ strace.microseconds ();
+#endif
+
+ /* Set the os_being_run global. */
+ set_os_type ();
+
main_environ = user_data->envptr;
+ *main_environ = NULL;
user_data->heapbase = user_data->heapptr = user_data->heaptop = NULL;
set_console_handler ();