diff options
-rw-r--r-- | winsup/cygwin/ChangeLog | 12 | ||||
-rw-r--r-- | winsup/cygwin/dtable.cc | 8 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/signal.h | 10 | ||||
-rw-r--r-- | winsup/cygwin/signal.cc | 18 |
4 files changed, 41 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index bb39a3dee4c..9c8ad9d4407 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,15 @@ +2004-01-17 Christopher Faylor <cgf@redhat.com> + + * signal.cc (sigwaitinfo): Define new function. + (sigwait): Redefine based on sigwaitinfo. + * include/cygwin/signal.h (sigwaitinfo): Declare. + (sigwait): Ditto. + +2004-01-17 Christopher Faylor <cgf@redhat.com> + + * dtable.cc (dtable::vfork_parent_restore): Avoid double close of ctty + when ctty == ctty_on_hold. + 2004-01-16 Christopher Faylor <cgf@redhat.com> * cygtls.h (_threadinfo::threadkill): New element. diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index c8d80e09156..d943e166b49 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -758,9 +758,11 @@ dtable::vfork_parent_restore () cfree (deleteme); unlock (); - cygheap->ctty = ctty_on_hold; // revert - if (cygheap->ctty) - cygheap->ctty->close (); // Undo previous bump of this archetype + if (cygheap->ctty != ctty_on_hold) + { + cygheap->ctty = ctty_on_hold; // revert + cygheap->ctty->close (); // Undo previous bump of this archetype + } cygheap->ctty_on_hold = NULL; return; diff --git a/winsup/cygwin/include/cygwin/signal.h b/winsup/cygwin/include/cygwin/signal.h index 767f86b01bf..20ab1c3a3df 100644 --- a/winsup/cygwin/include/cygwin/signal.h +++ b/winsup/cygwin/include/cygwin/signal.h @@ -1,6 +1,10 @@ #ifndef _CYGWIN_SIGNAL_H #define _CYGWIN_SIGNAL_H +#ifdef __cplusplus +extern "C" { +#endif + #if 0 struct ucontext { @@ -184,4 +188,10 @@ struct sigaction #define SIGUSR1 30 /* user defined signal 1 */ #define SIGUSR2 31 /* user defined signal 2 */ #define NSIG 32 /* signal 0 implied */ + +int sigwait (const sigset_t *, int *); +int sigwaitinfo (const sigset_t *, siginfo_t *); +#ifdef __cplusplus +} +#endif #endif /*_CYGWIN_SIGNAL_H*/ diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 72664b10d1e..4dde8127c69 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -478,9 +478,18 @@ siginterrupt (int sig, int flag) return sigaction (sig, &act, NULL); } +extern "C" int +sigwait (const sigset_t *set, int *sig_ptr) +{ + siginfo_t si; + int pid = sigwaitinfo (set, NULL); + if (pid > 0) + *sig_ptr = pid; + return pid > 0 ? 0 : -1; +} extern "C" int -sigwait (const sigset_t *set, int *sig) +sigwaitinfo (const sigset_t *set, siginfo_t *info) { pthread_testcancel (); HANDLE h; @@ -497,15 +506,16 @@ sigwait (const sigset_t *set, int *sig) switch (WaitForSingleObject (_my_tls.event, INFINITE)) { case WAIT_OBJECT_0: - *sig = InterlockedExchange ((LONG *) &_my_tls.sig, (LONG) 0); - res = 0; + res = _my_tls.infodata.si_pid; + if (info) + *info = _my_tls.infodata; break; default: __seterrno (); res = -1; } _my_tls.event = NULL; - _my_tls.sig = 0; + InterlockedExchange ((LONG *) &_my_tls.sig, (LONG) 0); CloseHandle (h); sig_dispatch_pending (); return res; |