diff options
author | Christopher Faylor <me@cgf.cx> | 2002-10-19 00:57:06 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-10-19 00:57:06 +0000 |
commit | a85860b5c868d7c3865e5d912916e51a55014ac7 (patch) | |
tree | a7f99789423abe1e850561f21ac783290c9d0195 | |
parent | 824166e620dcffbd338795d6944281bc022e9ecf (diff) | |
download | newlib-a85860b5c868d7c3865e5d912916e51a55014ac7.zip newlib-a85860b5c868d7c3865e5d912916e51a55014ac7.tar.gz newlib-a85860b5c868d7c3865e5d912916e51a55014ac7.tar.bz2 |
* dcrt0.cc (dll_crt0_1): Initialize cygwin threads here only when not forking.
* fork.cc (fork_child): Initialize cygwin thread later in process to avoid
allocating memory for thread stacks.
* shared.cc (open_shared): Issue warning if NT and shared segment is relocated.
-rw-r--r-- | winsup/cygwin/ChangeLog | 9 | ||||
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 8 | ||||
-rw-r--r-- | winsup/cygwin/fork.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/shared.cc | 4 |
4 files changed, 22 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9fbdfe4..a232919 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,14 @@ 2002-10-18 Christopher Faylor <cgf@redhat.com> + * dcrt0.cc (dll_crt0_1): Initialize cygwin threads here only when not + forking. + * fork.cc (fork_child): Initialize cygwin thread later in process to + avoid allocating memory for thread stacks. + * shared.cc (open_shared): Issue warning if NT and shared segment is + relocated. + +2002-10-18 Christopher Faylor <cgf@redhat.com> + * cygthread.cc: Bump number of cygthreads up to accommodate applications which use ttys. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 4270c58..64d5e22 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -573,7 +573,10 @@ dll_crt0_1 () char **envp = NULL; if (!child_proc_info) - memory_init (); + { + memory_init (); + cygthread::init (); + } else { bool close_ppid_handle = false; @@ -616,6 +619,7 @@ dll_crt0_1 () old_title = strcpy (title_buf, spawn_info->moreinfo->old_title); cfree (spawn_info->moreinfo->old_title); } + cygthread::init (); break; } if (close_hexec_proc) @@ -624,8 +628,6 @@ dll_crt0_1 () CloseHandle (child_proc_info->pppid_handle); } - cygthread::init (); - ProtectHandle (hMainProc); ProtectHandle (hMainThread); diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 0d57bc4..729de1d 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -30,6 +30,7 @@ details. */ #include "sync.h" #include "shared_info.h" #include "cygmalloc.h" +#include "cygthread.h" #ifdef DEBUGGING static int npid; @@ -284,7 +285,6 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) api_fatal ("recreate_mmaps_after_fork_failed"); pinfo_fixup_after_fork (); - signal_fixup_after_fork (); MALLOC_CHECK; @@ -307,6 +307,9 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) if (fixup_shms_after_fork ()) api_fatal ("recreate_shm areas after fork failed"); + cygthread::init (); + signal_fixup_after_fork (); + /* Set thread local stuff to zero. Under Windows 95/98 this is sometimes non-zero, for some reason. FIXME: There is a memory leak here after a fork. */ diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 45d51c3..9bcefe3 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -104,6 +104,10 @@ open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, shared_locat if (!shared) { +#ifdef DEBUGGING + if (wincap.is_winnt ()) + system_printf ("relocating shared object %s(%d) on Windows NT", name, n); +#endif /* Probably win95, so try without specifying the address. */ shared = (shared_info *) MapViewOfFileEx (shared_h, FILE_MAP_READ|FILE_MAP_WRITE, |