4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-07 15:00:24 +08:00

* 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.
This commit is contained in:
Christopher Faylor 2002-10-19 00:57:06 +00:00
parent 824166e620
commit a85860b5c8
4 changed files with 22 additions and 4 deletions

View File

@ -1,3 +1,12 @@
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> 2002-10-18 Christopher Faylor <cgf@redhat.com>
* cygthread.cc: Bump number of cygthreads up to accommodate * cygthread.cc: Bump number of cygthreads up to accommodate

View File

@ -573,7 +573,10 @@ dll_crt0_1 ()
char **envp = NULL; char **envp = NULL;
if (!child_proc_info) if (!child_proc_info)
memory_init (); {
memory_init ();
cygthread::init ();
}
else else
{ {
bool close_ppid_handle = false; bool close_ppid_handle = false;
@ -616,6 +619,7 @@ dll_crt0_1 ()
old_title = strcpy (title_buf, spawn_info->moreinfo->old_title); old_title = strcpy (title_buf, spawn_info->moreinfo->old_title);
cfree (spawn_info->moreinfo->old_title); cfree (spawn_info->moreinfo->old_title);
} }
cygthread::init ();
break; break;
} }
if (close_hexec_proc) if (close_hexec_proc)
@ -624,8 +628,6 @@ dll_crt0_1 ()
CloseHandle (child_proc_info->pppid_handle); CloseHandle (child_proc_info->pppid_handle);
} }
cygthread::init ();
ProtectHandle (hMainProc); ProtectHandle (hMainProc);
ProtectHandle (hMainThread); ProtectHandle (hMainThread);

View File

@ -30,6 +30,7 @@ details. */
#include "sync.h" #include "sync.h"
#include "shared_info.h" #include "shared_info.h"
#include "cygmalloc.h" #include "cygmalloc.h"
#include "cygthread.h"
#ifdef DEBUGGING #ifdef DEBUGGING
static int npid; static int npid;
@ -284,7 +285,6 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
api_fatal ("recreate_mmaps_after_fork_failed"); api_fatal ("recreate_mmaps_after_fork_failed");
pinfo_fixup_after_fork (); pinfo_fixup_after_fork ();
signal_fixup_after_fork ();
MALLOC_CHECK; MALLOC_CHECK;
@ -307,6 +307,9 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
if (fixup_shms_after_fork ()) if (fixup_shms_after_fork ())
api_fatal ("recreate_shm areas after fork failed"); 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 /* Set thread local stuff to zero. Under Windows 95/98 this is sometimes
non-zero, for some reason. non-zero, for some reason.
FIXME: There is a memory leak here after a fork. */ FIXME: There is a memory leak here after a fork. */

View File

@ -104,6 +104,10 @@ open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, shared_locat
if (!shared) 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. */ /* Probably win95, so try without specifying the address. */
shared = (shared_info *) MapViewOfFileEx (shared_h, shared = (shared_info *) MapViewOfFileEx (shared_h,
FILE_MAP_READ|FILE_MAP_WRITE, FILE_MAP_READ|FILE_MAP_WRITE,