1SIGHOLD(3P) POSIX Programmer's Manual SIGHOLD(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 sighold, sigignore, sigpause, sigrelse, sigset — signal management
14
16 #include <signal.h>
17
18 int sighold(int sig);
19 int sigignore(int sig);
20 int sigpause(int sig);
21 int sigrelse(int sig);
22 void (*sigset(int sig, void (*disp)(int)))(int);
23
25 Use of any of these functions is unspecified in a multi-threaded
26 process.
27
28 The sighold(), sigignore(), sigpause(), sigrelse(), and sigset() func‐
29 tions provide simplified signal management.
30
31 The sigset() function shall modify signal dispositions. The sig argu‐
32 ment specifies the signal, which may be any signal except SIGKILL and
33 SIGSTOP. The disp argument specifies the signal's disposition, which
34 may be SIG_DFL, SIG_IGN, or the address of a signal handler. If
35 sigset() is used, and disp is the address of a signal handler, the sys‐
36 tem shall add sig to the signal mask of the calling process before exe‐
37 cuting the signal handler; when the signal handler returns, the system
38 shall restore the signal mask of the calling process to its state prior
39 to the delivery of the signal. In addition, if sigset() is used, and
40 disp is equal to SIG_HOLD, sig shall be added to the signal mask of the
41 calling process and sig's disposition shall remain unchanged. If
42 sigset() is used, and disp is not equal to SIG_HOLD, sig shall be
43 removed from the signal mask of the calling process.
44
45 The sighold() function shall add sig to the signal mask of the calling
46 process.
47
48 The sigrelse() function shall remove sig from the signal mask of the
49 calling process.
50
51 The sigignore() function shall set the disposition of sig to SIG_IGN.
52
53 The sigpause() function shall remove sig from the signal mask of the
54 calling process and suspend the calling process until a signal is
55 received. The sigpause() function shall restore the signal mask of the
56 process to its original state before returning.
57
58 If the action for the SIGCHLD signal is set to SIG_IGN, child processes
59 of the calling processes shall not be transformed into zombie processes
60 when they terminate. If the calling process subsequently waits for its
61 children, and the process has no unwaited-for children that were trans‐
62 formed into zombie processes, it shall block until all of its children
63 terminate, and wait(), waitid(), and waitpid() shall fail and set errno
64 to [ECHILD].
65
67 Upon successful completion, sigset() shall return SIG_HOLD if the sig‐
68 nal had been blocked and the signal's previous disposition if it had
69 not been blocked. Otherwise, SIG_ERR shall be returned and errno set to
70 indicate the error.
71
72 The sigpause() function shall suspend execution of the thread until a
73 signal is received, whereupon it shall return −1 and set errno to
74 [EINTR].
75
76 For all other functions, upon successful completion, 0 shall be
77 returned. Otherwise, −1 shall be returned and errno set to indicate
78 the error.
79
81 These functions shall fail if:
82
83 EINVAL The sig argument is an illegal signal number.
84
85 The sigset() and sigignore() functions shall fail if:
86
87 EINVAL An attempt is made to catch a signal that cannot be caught, or
88 to ignore a signal that cannot be ignored.
89
90 The following sections are informative.
91
93 None.
94
96 The sigaction() function provides a more comprehensive and reliable
97 mechanism for controlling signals; new applications should use the
98 sigaction() function instead of the obsolescent sigset() function.
99
100 The sighold() function, in conjunction with sigrelse() or sigpause(),
101 may be used to establish critical regions of code that require the
102 delivery of a signal to be temporarily deferred. For broader portabil‐
103 ity, the pthread_sigmask() or sigprocmask() functions should be used
104 instead of the obsolescent sighold() and sigrelse() functions.
105
106 For broader portability, the sigsuspend() function should be used
107 instead of the obsolescent sigpause() function.
108
110 Each of these historic functions has a direct analog in the other func‐
111 tions which are required to be per-thread and thread-safe (aside from
112 sigprocmask(), which is replaced by pthread_sigmask()). The sigset()
113 function can be implemented as a simple wrapper for sigaction(). The
114 sighold() function is equivalent to sigprocmask() or pthread_sigmask()
115 with SIG_BLOCK set. The sigignore() function is equivalent to sigac‐
116 tion() with SIG_IGN set. The sigpause() function is equivalent to sig‐
117 suspend(). The sigrelse() function is equivalent to sigprocmask() or
118 pthread_sigmask() with SIG_UNBLOCK set.
119
121 These functions may be removed in a future version.
122
124 Section 2.4, Signal Concepts, exec, pause(), pthread_sigmask(), sigac‐
125 tion(), signal(), sigsuspend(), wait(), waitid()
126
127 The Base Definitions volume of POSIX.1‐2008, <signal.h>
128
130 Portions of this text are reprinted and reproduced in electronic form
131 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
132 -- Portable Operating System Interface (POSIX), The Open Group Base
133 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
134 cal and Electronics Engineers, Inc and The Open Group. (This is
135 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
136 event of any discrepancy between this version and the original IEEE and
137 The Open Group Standard, the original IEEE and The Open Group Standard
138 is the referee document. The original Standard can be obtained online
139 at http://www.unix.org/online.html .
140
141 Any typographical or formatting errors that appear in this page are
142 most likely to have been introduced during the conversion of the source
143 files to man page format. To report such errors, see https://www.ker‐
144 nel.org/doc/man-pages/reporting_bugs.html .
145
146
147
148IEEE/The Open Group 2013 SIGHOLD(3P)