123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #include <errno.h>
- #include <signal.h>
- #include <string.h> /* For the real memset prototype. */
- sigset_t _sigintr;
- __sighandler_t
- signal (int sig, __sighandler_t handler)
- {
- struct sigaction act, oact;
-
- if (handler == SIG_ERR || sig < 1 || sig >= NSIG)
- {
- __set_errno (EINVAL);
- return SIG_ERR;
- }
- act.sa_handler = handler;
- __sigemptyset (&act.sa_mask);
- __sigaddset (&act.sa_mask, sig);
- act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART;
-
- if (sigaction (sig, &act, &oact) < 0)
- return SIG_ERR;
- return oact.sa_handler;
- }
- libc_hidden_def(signal)
- #ifdef __UCLIBC_SUSV3_LEGACY__
- strong_alias(signal,bsd_signal)
- #endif
|