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>2002-01-11 05:24:06 +0300
committerChristopher Faylor <me@cgf.cx>2002-01-11 05:24:06 +0300
commit06486d9e55dc159c565bda7894e426033f4c9685 (patch)
treeb62ad34c3ca0ec4a38551577b3755592670b7c38 /winsup/cygwin/signal.cc
parentbb5225c236040065b2cefb6b143de95970b0313a (diff)
* exceptions.cc (sig_handle): Accept a second argument indicating whether the
signal came from this process or not. * sigproc.h: Reflect sig_handle arg change. * signal.cc (kill_pgrp): Add sigframe info. (abort): New function. Eliminates newlib function of same name. * sigproc.cc (wait_sig): Pass "signal from this process" value as arg 2.
Diffstat (limited to 'winsup/cygwin/signal.cc')
-rw-r--r--winsup/cygwin/signal.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index 652348302..3d9789d8c 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -13,6 +13,7 @@ details. */
#include "winsup.h"
#include <errno.h>
+#include <stdlib.h>
#include "cygerrno.h"
#include <sys/cygwin.h>
#include "sync.h"
@@ -190,6 +191,7 @@ _raise (int sig)
int
_kill (pid_t pid, int sig)
{
+ sigframe thisframe (mainthread);
syscall_printf ("kill (%d, %d)", pid, sig);
/* check that sig is in right range */
if (sig < 0 || sig >= NSIG)
@@ -214,6 +216,7 @@ kill_pgrp (pid_t pid, int sig)
int res = 0;
int found = 0;
int killself = 0;
+ sigframe thisframe (mainthread);
sigproc_printf ("pid %d, signal %d", pid, sig);
@@ -257,6 +260,31 @@ killpg (pid_t pgrp, int sig)
return _kill (-pgrp, sig);
}
+extern "C" void
+abort (void)
+{
+ sigframe thisframe (mainthread);
+ /* Flush all streams as per SUSv2.
+ From my reading of this document, this isn't strictly correct.
+ The streams are supposed to be flushed prior to exit. However,
+ if there is I/O in any signal handler that will not necessarily
+ be flushed.
+ However this is the way FreeBSD does it, and it is much easier to
+ do things this way, so... */
+ if (_reent_clib ()->__cleanup)
+ _reent_clib ()->__cleanup (_reent_clib ());
+
+ /* Ensure that SIGABRT can be caught regardless of blockage. */
+ sigset_t sig_mask;
+ sigfillset (&sig_mask);
+ sigdelset (&sig_mask, SIGABRT);
+ set_process_mask (sig_mask);
+
+ _raise (SIGABRT);
+ (void) thisframe.call_signal_handler (); /* Call any signal handler */
+ do_exit (1); /* signal handler didn't exit. Goodbye. */
+}
+
extern "C" int
sigaction (int sig, const struct sigaction *newact, struct sigaction *oldact)
{