X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsigprocmask.c;h=d6daca6ae2157b713efed0e0ea4f5b75d8a8a498;hb=6fe332a17fb940b8f7d988ec48968c6316c73ec6;hp=a8f2eb4e396568de7c7412e65f34640fe721f3b4;hpb=4b2f21b36a615728ebf2a0e1bc2c8def175703a8;p=gnulib.git diff --git a/lib/sigprocmask.c b/lib/sigprocmask.c index a8f2eb4e3..d6daca6ae 100644 --- a/lib/sigprocmask.c +++ b/lib/sigprocmask.c @@ -24,8 +24,6 @@ #include #include -#include "sig-handler.h" - /* We assume that a platform without POSIX signal blocking functions also does not have the POSIX sigaction() function, only the signal() function. We also assume signal() has SysV semantics, @@ -45,6 +43,8 @@ # define SIGSTOP (-1) #endif +typedef void (*handler_t) (int); + int sigismember (const sigset_t *set, int sig) { @@ -133,7 +133,7 @@ sigpending (sigset_t *set) /* The previous signal handlers. Only the array elements corresponding to blocked signals are relevant. */ -static volatile sa_handler_t old_handlers[NSIG]; +static volatile handler_t old_handlers[NSIG]; int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set) @@ -188,7 +188,8 @@ sigprocmask (int operation, const sigset_t *set, sigset_t *old_set) { if (signal (sig, old_handlers[sig]) != blocked_handler) /* The application changed a signal handler while the signal - was blocked. We don't support this. */ + was blocked, bypassing our rpl_signal replacement. + We don't support this. */ abort (); received[sig] = pending_array[sig]; blocked_set &= ~(1U << sig); @@ -207,8 +208,8 @@ sigprocmask (int operation, const sigset_t *set, sigset_t *old_set) /* Install the handler FUNC for signal SIG, and return the previous handler. */ -sa_handler_t -rpl_signal (int sig, sa_handler_t handler) +handler_t +rpl_signal (int sig, handler_t handler) { /* We must provide a wrapper, so that a user can query what handler they installed even if that signal is currently blocked. */ @@ -226,11 +227,12 @@ rpl_signal (int sig, sa_handler_t handler) stale information if it calls signal(B). Oh well - signal handlers really shouldn't try to manipulate the installed handlers of unrelated signals. */ - sa_handler_t result = old_handlers[sig]; + handler_t result = old_handlers[sig]; old_handlers[sig] = handler; return result; } - return signal (sig, handler); + else + return signal (sig, handler); } else {