1SIGSET(3)                  Linux Programmer's Manual                 SIGSET(3)
2
3
4

NAME

6       sigset, sighold, sigrelse, sigignore - System V signal API
7

SYNOPSIS

9       #include <signal.h>
10
11       typedef void (*sighandler_t)(int);
12
13       sighandler_t sigset(int sig, sighandler_t disp);
14
15       int sighold(int sig);
16       int sigrelse(int sig);
17       int sigignore(int sig);
18
19   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
20
21       sigset(), sighold(), sigrelse(), sigignore():
22           _XOPEN_SOURCE >= 500
23

DESCRIPTION

25       These  functions are provided in glibc as a compatibility interface for
26       programs that make use of the historical System V signal API.  This API
27       is  obsolete:  new applications should use the POSIX signal API (sigac‐
28       tion(2), sigprocmask(2), etc.)
29
30       The sigset() function modifies the disposition of the signal sig.   The
31       disp  argument  can be the address of a signal handler function, or one
32       of the following constants:
33
34       SIG_DFL
35              Reset the disposition of sig to the default.
36
37       SIG_IGN
38              Ignore sig.
39
40       SIG_HOLD
41              Add sig to the process's signal mask, but leave the  disposition
42              of sig unchanged.
43
44       If disp specifies the address of a signal handler, then sig is added to
45       the process's signal mask during execution of the handler.
46
47       If disp was specified as a value other than SIG_HOLD, then sig  is  re‐
48       moved from the process's signal mask.
49
50       The dispositions for SIGKILL and SIGSTOP cannot be changed.
51
52       The sighold() function adds sig to the calling process's signal mask.
53
54       The  sigrelse()  function removes sig from the calling process's signal
55       mask.
56
57       The sigignore() function sets the disposition of sig to SIG_IGN.
58

RETURN VALUE

60       On success, sigset() returns SIG_HOLD if sig  was  blocked  before  the
61       call, or the signal's previous disposition if it was not blocked before
62       the call.  On error, sigset() returns -1, with errno  set  to  indicate
63       the error.  (But see BUGS below.)
64
65       The  sighold(),  sigrelse(), and sigignore() functions return 0 on suc‐
66       cess; on error, these functions return -1 and set errno to indicate the
67       error.
68

ERRORS

70       For sigset() see the ERRORS under sigaction(2) and sigprocmask(2).
71
72       For sighold() and sigrelse() see the ERRORS under sigprocmask(2).
73
74       For sigignore(), see the errors under sigaction(2).
75

ATTRIBUTES

77       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
78       tributes(7).
79
80       ┌────────────────────────────────────────────┬───────────────┬─────────┐
81Interface                                   Attribute     Value   
82       ├────────────────────────────────────────────┼───────────────┼─────────┤
83sigset(), sighold(), sigrelse(),            │ Thread safety │ MT-Safe │
84sigignore()                                 │               │         │
85       └────────────────────────────────────────────┴───────────────┴─────────┘
86

CONFORMING TO

88       SVr4, POSIX.1-2001, POSIX.1-2008.  These functions are obsolete: do not
89       use them in new programs.  POSIX.1-2008 marks  sighold(),  sigignore(),
90       sigpause(3), sigrelse(), and sigset() as obsolete, recommending the use
91       of sigaction(2), sigprocmask(2), pthread_sigmask(3), and  sigsuspend(2)
92       instead.
93

NOTES

95       These functions appeared in glibc version 2.1.
96
97       The  sighandler_t type is a GNU extension; it is used on this page only
98       to make the sigset() prototype more easily readable.
99
100       The sigset() function provides reliable signal handling  semantics  (as
101       when calling sigaction(2) with sa_mask equal to 0).
102
103       On  System  V,  the signal() function provides unreliable semantics (as
104       when calling sigaction(2) with sa_mask equal to SA_RESETHAND | SA_NODE‐
105       FER).   On  BSD,  signal()  provides  reliable semantics.  POSIX.1-2001
106       leaves these aspects of signal() unspecified.  See signal(2)  for  fur‐
107       ther details.
108
109       In  order  to wait for a signal, BSD and System V both provided a func‐
110       tion named sigpause(3), but this function has a different  argument  on
111       the two systems.  See sigpause(3) for details.
112

BUGS

114       In  versions  of glibc before 2.2, sigset() did not unblock sig if disp
115       was specified as a value other than SIG_HOLD.
116
117       In versions of glibc before 2.5, sigset() does not correctly return the
118       previous  disposition  of  the  signal in two cases.  First, if disp is
119       specified as  SIG_HOLD,  then  a  successful  sigset()  always  returns
120       SIG_HOLD.   Instead,  it  should return the previous disposition of the
121       signal (unless the signal was blocked, in which case SIG_HOLD should be
122       returned).  Second, if the signal is currently blocked, then the return
123       value of a successful sigset() should be SIG_HOLD.  Instead, the previ‐
124       ous  disposition  of  the signal is returned.  These problems have been
125       fixed since glibc 2.5.
126

SEE ALSO

128       kill(2), pause(2), sigaction(2), signal(2),  sigprocmask(2),  raise(3),
129       sigpause(3), sigvec(3), signal(7)
130

COLOPHON

132       This  page  is  part of release 5.13 of the Linux man-pages project.  A
133       description of the project, information about reporting bugs,  and  the
134       latest     version     of     this    page,    can    be    found    at
135       https://www.kernel.org/doc/man-pages/.
136
137
138
139Linux                             2021-03-22                         SIGSET(3)
Impressum