diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-01-02 12:18:50 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-01-02 12:18:50 +0000 |
commit | b88ff80f703931b368d27ebd898accdae5b31e60 (patch) | |
tree | 79aa8e4d9b249e165973423a04fb3b4889308aa3 /libc/signal/sigintr.c | |
parent | cac4a2ef934d7ac5314c874b88b62e922fc70690 (diff) |
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
Diffstat (limited to 'libc/signal/sigintr.c')
-rw-r--r-- | libc/signal/sigintr.c | 35 |
1 files changed, 16 insertions, 19 deletions
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 } |