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-01-17 08:51:36 +0300
committerChristopher Faylor <me@cgf.cx>2004-01-17 08:51:36 +0300
commitd6572226d967a23e01a50ea63856d13ee9b9464e (patch)
treed445c8767eba16c5215dee5a0db5d3806596ac41
parent80a2f7b116869e2c3428d679294d0a401e77e977 (diff)
* signal.cc (sigwaitinfo): Define new function.
(sigwait): Redefine based on sigwaitinfo. * include/cygwin/signal.h (sigwaitinfo): Declare. (sigwait): Ditto. * dtable.cc (dtable::vfork_parent_restore): Avoid double close of ctty when ctty == ctty_on_hold.
-rw-r--r--winsup/cygwin/ChangeLog12
-rw-r--r--winsup/cygwin/dtable.cc8
-rw-r--r--winsup/cygwin/include/cygwin/signal.h10
-rw-r--r--winsup/cygwin/signal.cc18
4 files changed, 41 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index bb39a3dee..9c8ad9d44 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 c8d80e091..d943e166b 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 767f86b01..20ab1c3a3 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 72664b10d..4dde8127c 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;