# sighold

## PROLOG



           This manual page is part of the POSIX Programmer's Manual.  The
           Linux implementation of this interface may differ (consult the
           corresponding Linux manual page for details of Linux behavior), or
           the interface may not be implemented on Linux.
    


## NAME



           sighold, sigignore, sigpause, sigrelse, sigset — signal management
    


## SYNOPSIS



           #include <signal.h>
    
           int sighold(int _sig_);
           int sigignore(int _sig_);
           int sigpause(int _sig_);
           int sigrelse(int _sig_);
           void (*sigset(int _sig_ , void (*_disp_)(int)))(int);
    


## DESCRIPTION



           Use of any of these functions is unspecified in a multi-threaded
           process.
    
           The _sighold_(), _sigignore_(), _sigpause_(), _sigrelse_(), and _sigset_()
           functions provide simplified signal management.
    
           The _sigset_() function shall modify signal dispositions. The _sig_
           argument specifies the signal, which may be any signal except
           SIGKILL and SIGSTOP. The _disp_ argument specifies the signal's
           disposition, which may be SIG_DFL, SIG_IGN, or the address of a
           signal handler. If _sigset_() is used, and _disp_ is the address of a
           signal handler, the system shall add _sig_ to the signal mask of the
           calling process before executing the signal handler; when the
           signal handler returns, the system shall restore the signal mask
           of the calling process to its state prior to the delivery of the
           signal. In addition, if _sigset_() is used, and _disp_ is equal to
           SIG_HOLD, _sig_ shall be added to the signal mask of the calling
           process and _sig_ 's disposition shall remain unchanged. If _sigset_()
           is used, and _disp_ is not equal to SIG_HOLD, _sig_ shall be removed
           from the signal mask of the calling process.
    
           The _sighold_() function shall add _sig_ to the signal mask of the
           calling process.
    
           The _sigrelse_() function shall remove _sig_ from the signal mask of
           the calling process.
    
           The _sigignore_() function shall set the disposition of _sig_ to
           SIG_IGN.
    
           The _sigpause_() function shall remove _sig_ from the signal mask of
           the calling process and suspend the calling process until a signal
           is received. The _sigpause_() function shall restore the signal mask
           of the process to its original state before returning.
    
           If the action for the SIGCHLD signal is set to SIG_IGN, child
           processes of the calling processes shall not be transformed into
           zombie processes when they terminate. If the calling process
           subsequently waits for its children, and the process has no
           unwaited-for children that were transformed into zombie processes,
           it shall block until all of its children terminate, and _wait_(),
           _waitid_(), and _waitpid_() shall fail and set _errno_ to **[ECHILD]**.
    


## RETURN VALUE



           Upon successful completion, _sigset_() shall return SIG_HOLD if the
           signal had been blocked and the signal's previous disposition if
           it had not been blocked. Otherwise, SIG_ERR shall be returned and
           _errno_ set to indicate the error.
    
           The _sigpause_() function shall suspend execution of the thread
           until a signal is received, whereupon it shall return -1 and set
           _errno_ to **[EINTR]**.
    
           For all other functions, upon successful completion, 0 shall be
           returned.  Otherwise, -1 shall be returned and _errno_ set to
           indicate the error.
    


## ERRORS



           These functions shall fail if:
    
           **EINVAL** The _sig_ argument is an illegal signal number.
    
           The _sigset_() and _sigignore_() functions shall fail if:
    
           **EINVAL** An attempt is made to catch a signal that cannot be caught,
                  or to ignore a signal that cannot be ignored.
    
           _The following sections are informative._
    


## EXAMPLES



           None.
    


## APPLICATION USAGE



           The _sigaction_() function provides a more comprehensive and
           reliable mechanism for controlling signals; new applications
           should use the _sigaction_() function instead of the obsolescent
           _sigset_() function.
    
           The _sighold_() function, in conjunction with _sigrelse_() or
           _sigpause_(), may be used to establish critical regions of code that
           require the delivery of a signal to be temporarily deferred. For
           broader portability, the _pthread_sigmask_() or _sigprocmask_()
           functions should be used instead of the obsolescent _sighold_() and
           _sigrelse_() functions.
    
           For broader portability, the _sigsuspend_() function should be used
           instead of the obsolescent _sigpause_() function.
    


## RATIONALE



           Each of these historic functions has a direct analog in the other
           functions which are required to be per-thread and thread-safe
           (aside from _sigprocmask_(), which is replaced by
           _pthread_sigmask_()).  The _sigset_() function can be implemented as a
           simple wrapper for _sigaction_().  The _sighold_() function is
           equivalent to _sigprocmask_() or _pthread_sigmask_() with SIG_BLOCK
           set. The _sigignore_() function is equivalent to _sigaction_() with
           SIG_IGN set. The _sigpause_() function is equivalent to
           _sigsuspend_().  The _sigrelse_() function is equivalent to
           _sigprocmask_() or _pthread_sigmask_() with SIG_UNBLOCK set.
    


## FUTURE DIRECTIONS



           These functions may be removed in a future version.
    


* * *