diff options
author | Christopher Faylor <me@cgf.cx> | 2003-11-23 05:34:00 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-11-23 05:34:00 +0000 |
commit | 0670609d125cd894485cc965d17e0df3c0dc46dc (patch) | |
tree | d4ecbdf9a675c41875dfb709bd4491d609189568 | |
parent | c026d842096d534510b5448a31244e6921a2c60e (diff) | |
download | cygnal-0670609d125cd894485cc965d17e0df3c0dc46dc.tar.gz cygnal-0670609d125cd894485cc965d17e0df3c0dc46dc.tar.bz2 cygnal-0670609d125cd894485cc965d17e0df3c0dc46dc.zip |
* sigproc.cc (proc_exists): A zombie process does not exist.
(sig_send): Improve debugging output. Wait for pipe to be created before
trying to send to it. Call call_signal_handler_now if sending a signal to
myself.
-rw-r--r-- | winsup/cygwin/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/cygwin/sigproc.cc | 22 |
2 files changed, 22 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 4a87af0e9..d861cf088 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2003-11-23 Christopher Faylor <cgf@redhat.com> + + * sigproc.cc (proc_exists): A zombie process does not exist. + (sig_send): Improve debugging output. Wait for pipe to be created + before trying to send to it. Call call_signal_handler_now if sending a + signal to myself. + 2003-11-22 Christopher Faylor <cgf@redhat.com> * dcrt0.cc (check_sanity_and_sync): Correct api major version check so diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 680b12dc0..0578cad8c 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -1,8 +1,8 @@ /* sigproc.cc: inter/intra signal and sub process handler - Copyright 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc. - Written by Christopher Faylor <cgf@cygnus.com> + Written by Christopher Faylor This file is part of Cygwin. @@ -44,7 +44,7 @@ details. */ #define wake_wait_subproc() SetEvent (events[0]) -#define no_signals_available() (!hwait_sig || !sig_loop_wait) +#define no_signals_available() (!hwait_sig || !sig_loop_wait && !exit_state) #define NZOMBIES 256 @@ -267,7 +267,7 @@ pid_exists (pid_t pid) BOOL __stdcall proc_exists (_pinfo *p) { - return p && !(p->process_state & PID_EXITED); + return p && !(p->process_state & (PID_EXITED | PID_ZOMBIE)); } /* Return 1 if this is one of our children, zero otherwise. @@ -428,9 +428,8 @@ proc_subproc (DWORD what, DWORD val) goto scan_wait; /* Clear all waiting threads. Called from exceptions.cc prior to - * the main thread's dispatch to a signal handler function. - * (called from wait_sig thread) - */ + the main thread's dispatch to a signal handler function. + (called from wait_sig thread) */ case PROC_CLEARWAIT: /* Clear all "wait"ing threads. */ if (val) @@ -707,15 +706,20 @@ sig_send (_pinfo *p, int sig, DWORD ebp, bool exception) HANDLE hp = OpenProcess (PROCESS_DUP_HANDLE, false, p->dwProcessId); if (!hp) { + sigproc_printf ("OpenProcess failed, %E"); __seterrno (); goto out; } + for (int i = 0; !p->sendsig && i < 10000; i++) + low_priority_sleep (0); if (!DuplicateHandle (hp, p->sendsig, hMainProc, &sendsig, false, 0, DUPLICATE_SAME_ACCESS) || !sendsig) { + sigproc_printf ("DuplicateHandle failed, %E"); __seterrno (); goto out; } + CloseHandle (hp); pack.wakeup = NULL; } @@ -738,6 +742,7 @@ sig_send (_pinfo *p, int sig, DWORD ebp, bool exception) process is exiting. */ if (!its_me) { + sigproc_printf ("WriteFile for pipe %p failed, %E", sendsig); __seterrno (); ForceCloseHandle (sendsig); } @@ -784,6 +789,9 @@ sig_send (_pinfo *p, int sig, DWORD ebp, bool exception) rc = -1; } + if (wait_for_completion) + call_signal_handler_now (); + out: if (sig != __SIGPENDING) /* nothing */; |