nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

sig_block.c (633B)


      1 #include <signal.h>
      2 #include <stddef.h>
      3 #include "sig.h"
      4 #include "hassgprm.h"
      5 
      6 void sig_block(sig)
      7 int sig;
      8 {
      9 #ifdef HASSIGPROCMASK
     10   sigset_t ss;
     11   sigemptyset(&ss);
     12   sigaddset(&ss,sig);
     13   sigprocmask(SIG_BLOCK,&ss,NULL);
     14 #else
     15   sigblock(1 << (sig - 1));
     16 #endif
     17 }
     18 
     19 void sig_unblock(sig)
     20 int sig;
     21 {
     22 #ifdef HASSIGPROCMASK
     23   sigset_t ss;
     24   sigemptyset(&ss);
     25   sigaddset(&ss,sig);
     26   sigprocmask(SIG_UNBLOCK,&ss,NULL);
     27 #else
     28   sigsetmask(sigsetmask(~0) & ~(1 << (sig - 1)));
     29 #endif
     30 }
     31 
     32 void sig_blocknone()
     33 {
     34 #ifdef HASSIGPROCMASK
     35   sigset_t ss;
     36   sigemptyset(&ss);
     37   sigprocmask(SIG_SETMASK,&ss,NULL);
     38 #else
     39   sigsetmask(0);
     40 #endif
     41 }