13 #elif defined(__DARWIN_NSIG)
14 #define NSIG __DARWIN_NSIG
29 FDEBUG(1) <<
"in sigusr2 handler\n";
38 #if defined(__linux__)
54 #define MUST_BE_ZERO(fun) if((fun) != 0) \
55 { perror("UnixSignalHandlers::setupSignal: sig function failed"); abort(); }
64 MUST_BE_ZERO(pthread_sigmask(SIG_SETMASK,&myset,oldset));
71 #if defined(__linux__)
76 struct sigaction tmpact;
77 memset(&tmpact,0,
sizeof(tmpact));
78 tmpact.sa_handler = SIG_IGN;
80 for(
int num = SIGRTMIN;
num < SIGRTMAX; ++
num) {
120 #if defined(__linux__)
132 struct sigaction act;
133 memset(&act,0,
sizeof(act));
134 act.sa_sigaction = func;
135 act.sa_flags = SA_RESTART;
139 if( mysig == SIGKILL ) {
140 perror(
"Cannot install handler for KILL signal");
142 }
else if( mysig == SIGSTOP ) {
143 perror(
"Cannot install handler for STOP signal");
147 if(sigaction(mysig,&act,
NULL) != 0) {
148 perror(
"sigaction failed");
162 sigset_t tmpset, oldset;
169 MUST_BE_ZERO(pthread_sigmask( SIG_SETMASK, &tmpset, &oldset ));
171 for(
int k=1;
k<NSIG; ++
k) {
172 std::cerr <<
"sigismember is " << sigismember( &tmpset,
k )
173 <<
" for signal " << std::setw(2) <<
k
174 #if defined(__linux__)
175 <<
" (" << strsignal(
k) <<
")"
180 MUST_BE_ZERO(pthread_sigmask( SIG_SETMASK, &oldset, &tmpset));
void installSig(int signum, CFUNC func)
void disableAllSigs(sigset_t *oldset)
static boost::mutex mutex
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)
volatile int signum_value
void ep_sigusr2(int, siginfo_t *, void *)
volatile bool shutdown_flag
void(* CFUNC)(int, siginfo_t *, void *)
#define MUST_BE_ZERO(fun)