From b88ff80f703931b368d27ebd898accdae5b31e60 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 2 Jan 2002 12:18:50 +0000 Subject: Once again, rework the signal handling to be even more correct. We no longer segfault when running test/signal/sigchld.c, which exposed a bit of a rats nest. The problem ended up being a erroneous syscall defination, but in the process of finding that out, I scrubbed things up nicely and adapted things to use the rt_ signals if they are available. This now passes all the signal tests. -Erik --- libc/signal/sigintr.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'libc/signal/sigintr.c') diff --git a/libc/signal/sigintr.c b/libc/signal/sigintr.c index 483e5b71c..e8cdd9814 100644 --- a/libc/signal/sigintr.c +++ b/libc/signal/sigintr.c @@ -23,35 +23,32 @@ /* If INTERRUPT is nonzero, make signal SIG interrupt system calls (causing them to fail with EINTR); if INTERRUPT is zero, make system calls be restarted after signal SIG. */ -int -siginterrupt (sig, interrupt) - int sig; - int interrupt; +int siginterrupt (int sig, int interrupt) { #ifdef SA_RESTART - extern sigset_t _sigintr; /* Defined in signal.c. */ - struct sigaction action; + extern sigset_t _sigintr; /* Defined in signal.c. */ + struct sigaction action; - if (sigaction (sig, (struct sigaction *) NULL, &action) < 0) - return -1; + if (sigaction (sig, (struct sigaction *) NULL, &action) < 0) + return -1; - if (interrupt) + if (interrupt) { - sigaddset (&_sigintr, sig); - action.sa_flags &= ~SA_RESTART; + __sigaddset (&_sigintr, sig); + action.sa_flags &= ~SA_RESTART; } - else + else { - sigdelset (&_sigintr, sig); - action.sa_flags |= SA_RESTART; + __sigdelset (&_sigintr, sig); + action.sa_flags |= SA_RESTART; } - if (sigaction (sig, &action, (struct sigaction *) NULL) < 0) - return -1; + if (sigaction (sig, &action, (struct sigaction *) NULL) < 0) + return -1; - return 0; + return 0; #else - __set_errno (ENOSYS); - return -1; + __set_errno (ENOSYS); + return -1; #endif } -- cgit v1.2.3