diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2005-04-01 11:47:00 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2005-04-01 11:47:00 +0000 |
commit | b6e69d53f6479a67dc1e2309f6a56c68f30b228a (patch) | |
tree | 911e1d8d4373ce67d58b09b542f45330fc1cd484 /winsup/cygwin/fork.cc | |
parent | fefc73a0c7ad1a802b9f3df5503239ab6b4904c1 (diff) | |
download | cygnal-b6e69d53f6479a67dc1e2309f6a56c68f30b228a.tar.gz cygnal-b6e69d53f6479a67dc1e2309f6a56c68f30b228a.tar.bz2 cygnal-b6e69d53f6479a67dc1e2309f6a56c68f30b228a.zip |
* fork.cc (fork_child): Fixup SYSV IPC shared memory before fixing
up fdtab.
Diffstat (limited to 'winsup/cygwin/fork.cc')
-rw-r--r-- | winsup/cygwin/fork.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 4ae2d0a21..4a842131a 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -199,6 +199,17 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) if (fixup_mmaps_after_fork (hParent)) api_fatal ("recreate_mmaps_after_fork_failed"); +#ifdef USE_SERVER + /* Incredible but true: If we use sockets and SYSV IPC shared memory, + there's a good chance that a duplicated socket in the child occupies + memory which is needed to duplicate shared memory from the parent + process, if the shared memory hasn't been duplicated already. + The same goes very likely for "normal" mmap shared memory, too, but + with SYSV IPC it was the first time observed. So, *never* fixup + fdtab before fixing up shared memory. */ + if (fixup_shms_after_fork ()) + api_fatal ("recreate_shm areas after fork failed"); +#endif MALLOC_CHECK; @@ -226,11 +237,6 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) _my_tls.fixup_after_fork (); sigproc_init (); -#ifdef USE_SERVER - if (fixup_shms_after_fork ()) - api_fatal ("recreate_shm areas after fork failed"); -#endif - pthread::atforkchild (); fixup_timers_after_fork (); fixup_hooks_after_fork (); |