*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> sigsetmask (3)              
Title
Content
Arch
Section
 

SIGSETMASK(3)

Contents


NAME    [Toc]    [Back]

     sigsetmask - set current signal mask

SYNOPSIS    [Toc]    [Back]

     #include <signal.h>

     int
     sigsetmask(int mask);

     sigmask(int signum);

DESCRIPTION    [Toc]    [Back]

     This interface is made obsoleted by:  sigprocmask(2).

     sigsetmask() sets the  current  signal  mask.   Signals  are
blocked from delivery
  if  the  corresponding bit in mask is a 1; the macro
sigmask() is
     provided to construct the mask for a given signum.

     The system  quietly  disallows  SIGKILL  or  SIGSTOP  to  be
blocked.

RETURN VALUES    [Toc]    [Back]

     The previous set of masked signals is returned.

EXAMPLES    [Toc]    [Back]

     The following example utilizing sigsetmask():

           int omask;

           omask = sigblock(sigmask(SIGINT) | sigmask(SIGHUP));

           ...

           sigsetmask(omask    &    ~(sigmask(SIGINT)    |   sigmask(SIGHUP)));

     Could be converted literally to:

           sigset_t set, oset;

           sigemptyset(&set);
           sigaddset(&set, SIGINT);
           sigaddset(&set, SIGHUP);
           sigprocmask(SIG_BLOCK, &set, &oset);

           ...

           sigdelset(&oset, SIGINT);
           sigdelset(&oset, SIGHUP);
           sigprocmask(SIG_SETMASK, &oset, NULL);

     Another, clearer, alternative is:

           sigset_t set;

           sigemptyset(&set);
           sigaddset(&set, SIGINT);
           sigaddset(&set, SIGHUP);
           sigprocmask(SIG_BLOCK, &set, NULL);

           ...

           sigprocmask(SIG_UNBLOCK, &set, NULL);

     To completely clear the signal mask using  sigsetmask()  one
can do:

           (void) sigsetmask(0);

     Which can be expressed via sigprocmask(2) as:

           sigset_t eset;

           sigemptyset(&eset);
           (void) sigprocmask(SIG_SETMASK, &eset, NULL);

SEE ALSO    [Toc]    [Back]

      
      
     kill(2),  sigaction(2),  sigprocmask(2), sigsuspend(2), sigblock(3),
     sigsetops(3), sigvec(3)

HISTORY    [Toc]    [Back]

     The sigsetmask() function call appeared in  4.2BSD  and  has
been deprecated.


OpenBSD      3.6                          March      10,     1991
[ Back ]
 Similar pages
Name OS Title
sigprocmask Tru64 Set the current signal mask
sigsetmask Tru64 Set the current signal mask
sigblock FreeBSD manipulate current signal mask
sigprocmask FreeBSD manipulate current signal mask
sigprocmask OpenBSD manipulate current signal mask
sigprocmask NetBSD manipulate current signal mask
sigsetmask FreeBSD manipulate current signal mask
sigmask FreeBSD manipulate current signal mask
sigsetmask IRIX set current signal mask (4.3BSD)
pthread_sigmask Tru64 Examine or change the current thread's signal mask
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service