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

NAME

6       sigsuspend, rt_sigsuspend - wait for a signal
7

SYNOPSIS

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():
16           _POSIX_C_SOURCE
17

DESCRIPTION

19       sigsuspend() temporarily replaces the signal mask of the calling thread
20       with the mask given by mask and then suspends the thread until delivery
21       of  a signal whose action is to invoke a signal handler or to terminate
22       a process.
23
24       If the signal terminates the process, then sigsuspend()  does  not  re‐
25       turn.   If  the  signal  is caught, then sigsuspend() returns after the
26       signal handler returns, and the signal mask is restored  to  the  state
27       before the call to sigsuspend().
28
29       It  is  not possible to block SIGKILL or SIGSTOP; specifying these sig‐
30       nals in mask, has no effect on the thread's signal mask.
31

RETURN VALUE

33       sigsuspend() always returns -1, with errno set to  indicate  the  error
34       (normally, EINTR).
35

ERRORS

37       EFAULT mask  points  to memory which is not a valid part of the process
38              address space.
39
40       EINTR  The call was interrupted by a signal; signal(7).
41

CONFORMING TO

43       POSIX.1-2001, POSIX.1-2008.
44

NOTES

46       Normally, sigsuspend() is used in conjunction  with  sigprocmask(2)  in
47       order  to prevent delivery of a signal during the execution of a criti‐
48       cal code section.  The caller first blocks the  signals  with  sigproc‐
49       mask(2).   When  the critical code has completed, the caller then waits
50       for the signals by calling sigsuspend() with the signal mask  that  was
51       returned by sigprocmask(2) (in the oldset argument).
52
53       See sigsetops(3) for details on manipulating signal sets.
54
55   C library/kernel differences
56       The  original  Linux system call was named sigsuspend().  However, with
57       the addition of real-time signals in Linux 2.2, the fixed-size,  32-bit
58       sigset_t  type supported by that system call was no longer fit for pur‐
59       pose.  Consequently, a new system call, rt_sigsuspend(), was  added  to
60       support  an enlarged sigset_t type.  The new system call takes a second
61       argument, size_t sigsetsize, which specifies the size in bytes  of  the
62       signal  set  in  mask.  This argument is currently required to have the
63       value sizeof(sigset_t) (or the error EINVAL results).  The  glibc  sig‐
64       suspend()  wrapper  function hides these details from us, transparently
65       calling rt_sigsuspend() when the kernel provides it.
66

SEE ALSO

68       kill(2), pause(2), sigaction(2),  signal(2),  sigprocmask(2),  sigwait‐
69       info(2), sigsetops(3), sigwait(3), signal(7)
70

COLOPHON

72       This  page  is  part of release 5.13 of the Linux man-pages project.  A
73       description of the project, information about reporting bugs,  and  the
74       latest     version     of     this    page,    can    be    found    at
75       https://www.kernel.org/doc/man-pages/.
76
77
78
79Linux                             2021-03-22                     SIGSUSPEND(2)
Impressum