13 #elif defined(__DARWIN_NSIG) 14 #define NSIG __DARWIN_NSIG 27 FDEBUG(1) <<
"in sigusr2 handler\n";
31 #define MUST_BE_ZERO(fun) if((fun) != 0) \ 32 { perror("UnixSignalHandlers::setupSignal: sig function failed"); abort(); } 41 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) {
59 if(
num == 38)
continue;
101 #if defined(__linux__) 113 struct sigaction act;
114 memset(&act,0,
sizeof(act));
115 act.sa_sigaction =
func;
116 act.sa_flags = SA_RESTART;
120 if( mysig == SIGKILL ) {
121 perror(
"Cannot install handler for KILL signal");
123 }
else if( mysig == SIGSTOP ) {
124 perror(
"Cannot install handler for STOP signal");
128 if(sigaction(mysig,&act,
NULL) != 0) {
129 perror(
"sigaction failed");
143 sigset_t tmpset, oldset;
150 MUST_BE_ZERO(pthread_sigmask( SIG_SETMASK, &tmpset, &oldset ));
152 for(
int k=1;
k<NSIG; ++
k) {
153 std::cerr <<
"sigismember is " << sigismember( &tmpset,
k )
154 <<
" for signal " << std::setw(2) <<
k 155 #if defined(__linux__) 156 <<
" (" << strsignal(
k) <<
")" 161 MUST_BE_ZERO(pthread_sigmask( SIG_SETMASK, &oldset, &tmpset));
void installSig(int signum, CFUNC func)
void disableAllSigs(sigset_t *oldset)
volatile std::atomic< bool > shutdown_flag
void installCustomHandler(int signum, CFUNC func)
void enableSignal(sigset_t *newset, int signum)
void reenableSigs(sigset_t *oldset)
void disableSignal(sigset_t *newset, int signum)
void(* CFUNC)(int, siginfo_t *, void *)
void ep_sigusr2(int, siginfo_t *, void *)
#define MUST_BE_ZERO(fun)