1SIGSUSPEND(2) Linux Programmer's Manual SIGSUSPEND(2)
2
3
4
6 sigsuspend, rt_sigsuspend - wait for a signal
7
9 #include <signal.h>
10
11 int sigsuspend(const sigset_t *mask);
12
13 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15 sigsuspend(): _POSIX_C_SOURCE
16
18 sigsuspend() temporarily replaces the signal mask of the calling
19 process with the mask given by mask and then suspends the process until
20 delivery of a signal whose action is to invoke a signal handler or to
21 terminate a process.
22
23 If the signal terminates the process, then sigsuspend() does not
24 return. If the signal is caught, then sigsuspend() returns after the
25 signal handler returns, and the signal mask is restored to the state
26 before the call to sigsuspend().
27
28 It is not possible to block SIGKILL or SIGSTOP; specifying these sig‐
29 nals in mask, has no effect on the process's signal mask.
30
32 sigsuspend() always returns -1, with errno set to indicate the error
33 (normally, EINTR).
34
36 EFAULT mask points to memory which is not a valid part of the process
37 address space.
38
39 EINTR The call was interrupted by a signal; signal(7).
40
42 POSIX.1-2001, POSIX.1-2008.
43
45 Normally, sigsuspend() is used in conjunction with sigprocmask(2) in
46 order to prevent delivery of a signal during the execution of a criti‐
47 cal code section. The caller first blocks the signals with sigproc‐
48 mask(2). When the critical code has completed, the caller then waits
49 for the signals by calling sigsuspend() with the signal mask that was
50 returned by sigprocmask(2) (in the oldset argument).
51
52 See sigsetops(3) for details on manipulating signal sets.
53
54 C library/kernel differences
55 The original Linux system call was named sigsuspend(). However, with
56 the addition of real-time signals in Linux 2.2, the fixed-size, 32-bit
57 sigset_t type supported by that system call was no longer fit for pur‐
58 pose. Consequently, a new system call, rt_sigsuspend(), was added to
59 support an enlarged sigset_t type. The new system call takes a second
60 argument, size_t sigsetsize, which specifies the size in bytes of the
61 signal set in mask. This argument is currently required to have the
62 value sizeof(sigset_t) (or the error EINVAL results). The glibc sig‐
63 suspend() wrapper function hides these details from us, transparently
64 calling rt_sigsuspend() when the kernel provides it.
65
67 kill(2), pause(2), sigaction(2), signal(2), sigprocmask(2), sigwait‐
68 info(2), sigsetops(3), sigwait(3), signal(7)
69
71 This page is part of release 4.15 of the Linux man-pages project. A
72 description of the project, information about reporting bugs, and the
73 latest version of this page, can be found at
74 https://www.kernel.org/doc/man-pages/.
75
76
77
78Linux 2017-09-15 SIGSUSPEND(2)