aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/sigproc.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-09-01 02:05:32 +0000
committerChristopher Faylor <me@cgf.cx>2003-09-01 02:05:32 +0000
commitc0a9bffd03e62822959ba8cb0e8b083f1ec4b871 (patch)
tree082ab97e9d152193eabac86503a27cf467becb6a /winsup/cygwin/sigproc.cc
parent40d885eb7bb53e9f049f999a23d6aa9087649009 (diff)
downloadnewlib-c0a9bffd03e62822959ba8cb0e8b083f1ec4b871.zip
newlib-c0a9bffd03e62822959ba8cb0e8b083f1ec4b871.tar.gz
newlib-c0a9bffd03e62822959ba8cb0e8b083f1ec4b871.tar.bz2
* cygheap.cc (cygheap_init): Allocate space for sigaction array in cygheap.
* cygheap.h (cygheap_types): Add HEAP_SIGS. * exceptions.cc (signal_fixup_after_exec): Remove from this file. * pinfo.h (pinfo::getsig): Just return global_sigs array. (pinfo::sigs): Delete. * sigproc.cc (signal_fixup_after_exec): Move it here. (global_sigs): New global array, moved from pinfo structure. (sigalloc): New function. Allocate global sigaction array here. (proc_subproc): Remove copysigs call. It's automatic now. * include/sys/cygwin.h (PID_NOCLDSTOP): New value. * signal.cc (sigaction): Set myself->PID_NODCLDSTOP when appropriate. * sigproc.h (sigalloc): Declare. * fnmatch.c (fnmatch): Use C90 parameters. (rangematch): Ditto. * fhandler.cc (fhandler_base::raw_read): Use right coercion to avoid a compiler warning.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc29
1 files changed, 26 insertions, 3 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index af20541..b14fbac 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -17,6 +17,7 @@ details. */
#include <stdlib.h>
#include <sys/cygwin.h>
#include <assert.h>
+#include <sys/signal.h>
#include "cygerrno.h"
#include "sync.h"
#include "sigproc.h"
@@ -48,12 +49,35 @@ details. */
#define NZOMBIES 256
-LONG local_sigtodo[TOTSIGS];
-inline LONG* getlocal_sigtodo (int sig)
+static LONG local_sigtodo[TOTSIGS];
+struct sigaction *global_sigs;
+
+inline LONG *
+getlocal_sigtodo (int sig)
{
return local_sigtodo + __SIGOFFSET + sig;
}
+void __stdcall
+sigalloc ()
+{
+ cygheap->sigs = global_sigs =
+ (struct sigaction *) ccalloc (HEAP_SIGS, NSIG, sizeof (struct sigaction));
+}
+
+void __stdcall
+signal_fixup_after_exec ()
+{
+ global_sigs = cygheap->sigs;
+ /* Set up child's signal handlers */
+ for (int i = 0; i < NSIG; i++)
+ {
+ myself->getsig (i).sa_mask = 0;
+ if (myself->getsig (i).sa_handler != SIG_IGN)
+ myself->getsig (i).sa_handler = SIG_DFL;
+ }
+}
+
/*
* Global variables
*/
@@ -300,7 +324,6 @@ proc_subproc (DWORD what, DWORD val)
vchild->sid = myself->sid;
vchild->ctty = myself->ctty;
vchild->process_state |= PID_INITIALIZING | (myself->process_state & PID_USETTY);
- vchild->copysigs (myself);
sigproc_printf ("added pid %d to wait list, slot %d, winpid %p, handle %p",
vchild->pid, nchildren, vchild->dwProcessId,