13 #elif defined(__DARWIN_NSIG)
14 #define NSIG __DARWIN_NSIG
26 FDEBUG(1) <<
"in sigusr2 handler\n";
30 #define MUST_BE_ZERO(fun) \
32 perror("UnixSignalHandlers::setupSignal: sig function failed"); \
42 MUST_BE_ZERO(pthread_sigmask(SIG_SETMASK, &myset, oldset));
48 #if defined(__linux__)
53 struct sigaction tmpact;
54 memset(&tmpact, 0,
sizeof(tmpact));
55 tmpact.sa_handler = SIG_IGN;
57 for (
int num = SIGRTMIN;
num <= SIGRTMAX; ++
num) {
66 MUST_BE_ZERO(pthread_sigmask(SIG_BLOCK, &myset,
nullptr));
74 MUST_BE_ZERO(pthread_sigmask(SIG_SETMASK, oldset,
nullptr));
96 #if defined(__linux__)
107 struct sigaction act;
108 memset(&act, 0,
sizeof(act));
109 act.sa_sigaction =
func;
110 act.sa_flags = SA_RESTART;
114 if (mysig == SIGKILL) {
115 perror(
"Cannot install handler for KILL signal");
117 }
else if (mysig == SIGSTOP) {
118 perror(
"Cannot install handler for STOP signal");
122 if (sigaction(mysig, &act,
nullptr) != 0) {
123 perror(
"sigaction failed");
130 MUST_BE_ZERO(pthread_sigmask(SIG_UNBLOCK, &newset,
nullptr));
136 sigset_t tmpset, oldset;
143 MUST_BE_ZERO(pthread_sigmask(SIG_SETMASK, &tmpset, &oldset));
145 for (
int k = 1;
k < NSIG; ++
k) {
146 std::cerr <<
"sigismember is " << sigismember(&tmpset,
k) <<
" for signal " << std::setw(2) <<
k
147 #if defined(__linux__)
148 <<
" (" << strsignal(
k) <<
")"
153 MUST_BE_ZERO(pthread_sigmask(SIG_SETMASK, &oldset, &tmpset));