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) {
97 #if defined(__linux__)
109 struct sigaction act;
110 memset(&act,0,
sizeof(act));
111 act.sa_sigaction =
func;
112 act.sa_flags = SA_RESTART;
116 if( mysig == SIGKILL ) {
117 perror(
"Cannot install handler for KILL signal");
119 }
else if( mysig == SIGSTOP ) {
120 perror(
"Cannot install handler for STOP signal");
124 if(sigaction(mysig,&act,
NULL) != 0) {
125 perror(
"sigaction failed");
139 sigset_t tmpset, oldset;
146 MUST_BE_ZERO(pthread_sigmask( SIG_SETMASK, &tmpset, &oldset ));
148 for(
int k=1;
k<NSIG; ++
k) {
149 std::cerr <<
"sigismember is " << sigismember( &tmpset,
k )
150 <<
" for signal " << std::setw(2) <<
k
151 #if defined(__linux__)
152 <<
" (" << strsignal(
k) <<
")"
157 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 ep_sigusr2(int, siginfo_t *, void *)
void(* CFUNC)(int, siginfo_t *, void *)
#define MUST_BE_ZERO(fun)