Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-09-12 07:47:57 +0400
committerChristopher Faylor <me@cgf.cx>2004-09-12 07:47:57 +0400
commitd584454c8231f5811136b1ab88defe6e5ca81923 (patch)
tree895b902952e3c3d4e329703af6ccc29275b9fec5 /winsup/cygwin/fork.cc
parentca5ec6685a79620c1e24d2ca19081ee4f432b316 (diff)
* exceptions.cc: (ctrl_c_handler): Do nothing while a Cygwin subprocess is
starting. * child_info.h (init_child_info): Remove pid argument from declaration. * cygheap.h (init_cygheap::pid): New element. * dcrt0.cc (dll_crt0_0): Eliminate handling of now-noexistent cygpid parameter in child_info struct. Set forkee to 'true' rather than cygpid since the pid value was never used. (dll_crt0_1): Ditto. (_dll_crt0): Ditto. * fork.cc (fork_child): Don't wait for sigthread. This is handled in the fork call now. (fork_parent): Remove obsolete pid argument from init_child_info call. Don't do anything special with cygpid when DEBUGGING. (fork): Delay all signals during fork. (fork_init): Don't do anything special when DEBUGGING. * pinfo.cc (set_myself): Remove pid parameter. Use new pid field in cygheap. (pinfo_init): Don't pass pid argument to set_myself. * sigproc.cc (sig_send): Wait for dwProcessId to be non-zero as well as sendsig. (init_child_info): Eliminate handling of pid. (wait_sig): Implement method to temporarily hold off sending signals. * sigproc.h (__SIGHOLD): New enum. (__SIGNOHOLD): Ditto. * spawn.cc (spawn_guts): Remove obsolete pid argument from init_child_info call.
Diffstat (limited to 'winsup/cygwin/fork.cc')
-rw-r--r--winsup/cygwin/fork.cc39
1 files changed, 3 insertions, 36 deletions
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 1fcca437e..a2571a964 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -31,12 +31,6 @@ details. */
#include "cygmalloc.h"
#include "cygthread.h"
-#ifdef DEBUGGING
-static int npid;
-static int npid_max;
-static pid_t fork_pids[100];
-#endif
-
/* Timeout to wait for child to start, parent to init child, etc. */
/* FIXME: Once things stabilize, bump up to a few minutes. */
#define FORK_WAIT_TIMEOUT (300 * 1000) /* 300 seconds */
@@ -318,7 +312,6 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
pthread::atforkchild ();
fixup_timers_after_fork ();
- wait_for_sigthread ();
cygbench ("fork-child");
cygwin_finished_initializing = true;
return 0;
@@ -425,7 +418,7 @@ fork_parent (HANDLE& hParent, dll *&first_dll,
ProtectHandleINH (subproc_ready);
ProtectHandleINH (forker_finished);
- init_child_info (PROC_FORK, &ch, 1, subproc_ready);
+ init_child_info (PROC_FORK, &ch, subproc_ready);
ch.forker_finished = forker_finished;
@@ -439,23 +432,6 @@ fork_parent (HANDLE& hParent, dll *&first_dll,
cygheap->user.deimpersonate ();
ch.parent = hParent;
-#ifdef DEBUGGING
- if (npid_max)
- {
- for (int pass = 0; pass < 2; pass++)
- {
- pid_t pid;
- while ((pid = fork_pids[npid++]))
- if (!pinfo (pid))
- {
- ch.cygpid = pid;
- goto out;
- }
- npid = 0;
- }
- }
- out:
-#endif
syscall_printf ("CreateProcess (%s, %s, 0, 0, 1, %x, 0, 0, %p, %p)",
myself->progname, myself->progname, c_flags, &si, &pi);
@@ -499,11 +475,7 @@ fork_parent (HANDLE& hParent, dll *&first_dll,
ResumeThread (pi.hThread);
}
-#ifdef DEBUGGING
- int forked_pid = ch.cygpid != 1 ? ch.cygpid : cygwin_pid (pi.dwProcessId);
-#else
int forked_pid = cygwin_pid (pi.dwProcessId);
-#endif
pinfo forked (forked_pid, 1);
if (!forked)
@@ -665,11 +637,13 @@ fork ()
child_info_fork ch;
+ sig_send (NULL, __SIGHOLD);
int res = setjmp (ch.jmp);
if (res)
res = fork_child (grouped.hParent, grouped.first_dll, grouped.load_dlls);
else
res = fork_parent (grouped.hParent, grouped.first_dll, grouped.load_dlls, esp, ch);
+ sig_send (NULL, __SIGNOHOLD);
MALLOC_CHECK;
syscall_printf ("%d = fork()", res);
@@ -679,13 +653,6 @@ fork ()
void
fork_init ()
{
- char buf[1024];
- if (!GetEnvironmentVariable ("CYGWIN_FORK_PIDS", buf, 1024))
- return;
- pid_t pid;
- char *p, *pe;
- for (p = buf; (pid = strtol (p, &pe, 10)); p = pe)
- fork_pids[npid_max++] = pid;
}
#endif /*DEBUGGING*/