123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #include <stddef.h>
- #include <signal.h>
- #include <errno.h>
- int siginterrupt (int sig, int interrupt)
- {
- #ifdef SA_RESTART
- extern sigset_t _sigintr;
- struct sigaction action;
- if (sigaction (sig, (struct sigaction *) NULL, &action) < 0)
- return -1;
- if (interrupt)
- {
- __sigaddset (&_sigintr, sig);
- action.sa_flags &= ~SA_RESTART;
- }
- else
- {
- __sigdelset (&_sigintr, sig);
- action.sa_flags |= SA_RESTART;
- }
- if (sigaction (sig, &action, (struct sigaction *) NULL) < 0)
- return -1;
- return 0;
- #else
- __set_errno (ENOSYS);
- return -1;
- #endif
- }
|