]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/sigsuspend.2
_exit.2, access.2, brk.2, chmod.2, clone.2, epoll_wait.2, eventfd.2, fork.2, getgroup...
[thirdparty/man-pages.git] / man2 / sigsuspend.2
CommitLineData
924dca35 1.\" Copyright (c) 2005 Michael Kerrisk
c13182ef 2.\" based on earlier work by faith@cs.unc.edu and
924dca35
MK
3.\" Mike Battersby <mib@deakin.edu.au>
4.\"
93015253 5.\" %%%LICENSE_START(VERBATIM)
924dca35
MK
6.\" Permission is granted to make and distribute verbatim copies of this
7.\" manual provided the copyright notice and this permission notice are
8.\" preserved on all copies.
9.\"
10.\" Permission is granted to copy and distribute modified versions of this
11.\" manual under the conditions for verbatim copying, provided that the
12.\" entire resulting derived work is distributed under the terms of a
13.\" permission notice identical to this one.
c13182ef 14.\"
924dca35
MK
15.\" Since the Linux kernel and libraries are constantly changing, this
16.\" manual page may be incorrect or out-of-date. The author(s) assume no
17.\" responsibility for errors or omissions, or for damages resulting from
18.\" the use of the information contained herein. The author(s) may not
19.\" have taken the same level of care in the production of this manual,
20.\" which is licensed free of charge, as they might when working
21.\" professionally.
c13182ef 22.\"
924dca35
MK
23.\" Formatted or processed versions of this manual, if unaccompanied by
24.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 25.\" %%%LICENSE_END
924dca35
MK
26.\"
27.\" 2005-09-15, mtk, Created new page by splitting off from sigaction.2
28.\"
1e64c86b 29.TH SIGSUSPEND 2 2015-03-29 "Linux" "Linux Programmer's Manual"
924dca35 30.SH NAME
1edfe5ac 31sigsuspend, rt_sigsuspend \- wait for a signal
924dca35
MK
32.SH SYNOPSIS
33.B #include <signal.h>
34.sp
35.BI "int sigsuspend(const sigset_t *" mask );
0f200f07
MK
36.sp
37.in -4n
38Feature Test Macro Requirements for glibc (see
39.BR feature_test_macros (7)):
40.in
41.sp
42.ad l
43.BR sigsuspend ():
44_POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
45.ad b
924dca35
MK
46.SH DESCRIPTION
47.BR sigsuspend ()
48temporarily replaces the signal mask of the calling process with the
c13182ef 49mask given by
924dca35
MK
50.I mask
51and then suspends the process until delivery of a signal whose
52action is to invoke a signal handler or to terminate a process.
53
54If the signal terminates the process, then
55.BR sigsuspend ()
56does not return.
57If the signal is caught, then
58.BR sigsuspend ()
59returns after the signal handler returns,
60and the signal mask is restored to the state before the call to
61.BR sigsuspend ().
62
8bd58774
MK
63It is not possible to block
64.B SIGKILL
65or
66.BR SIGSTOP ;
924dca35
MK
67specifying these signals in
68.IR mask ,
69has no effect on the process's signal mask.
47297adb 70.SH RETURN VALUE
924dca35 71.BR sigsuspend ()
d038a74a
MK
72always returns \-1, with
73.I errno
48b58f28 74set to indicate the error (normally,
d038a74a 75.BR EINTR ).
924dca35
MK
76.SH ERRORS
77.TP
78.B EFAULT
79.I mask
80points to memory which is not a valid part of the process address space.
81.TP
82.B EINTR
83The call was interrupted by a signal.
47297adb 84.SH CONFORMING TO
2dd578fd 85POSIX.1-2001.
924dca35
MK
86.SH NOTES
87.PP
c13182ef 88Normally,
924dca35
MK
89.BR sigsuspend ()
90is used in conjunction with
0bfa087b 91.BR sigprocmask (2)
c13182ef 92in order to prevent delivery of a signal during the execution of a
924dca35
MK
93critical code section.
94The caller first blocks the signals with
0bfa087b 95.BR sigprocmask (2).
924dca35
MK
96When the critical code has completed, the caller then waits for the
97signals by calling
98.BR sigsuspend ()
99with the signal mask that was returned by
0bfa087b 100.BR sigprocmask (2)
924dca35 101(in the
0daa9e92 102.I oldset
924dca35
MK
103argument).
104.PP
105See
106.BR sigsetops (3)
107for details on manipulating signal sets.
1edfe5ac 108.\"
0722a578 109.SS C library/kernel differences
1edfe5ac
MK
110The original Linux system call was named
111.BR sigsuspend ().
112However, with the addition of real-time signals in Linux 2.2,
113the fixed-size, 32-bit
114.IR sigset_t
115type supported by that system call was no longer fit for purpose.
116Consequently, a new system call,
117.BR rt_sigsuspend (),
118was added to support an enlarged
119.IR sigset_t
120type.
121The new system call takes a second argument,
122.IR "size_t sigsetsize" ,
123which specifies the size in bytes of the signal set in
124.IR mask .
125This argument is currently required to have the value
126.IR sizeof(sigset_t)
127(or the error
128.B EINVAL
129results).
130The glibc
131.BR sigsuspend ()
132wrapper function hides these details from us, transparently calling
133.BR rt_sigsuspend ()
134when the kernel provides it.
135.\"
47297adb 136.SH SEE ALSO
924dca35
MK
137.BR kill (2),
138.BR pause (2),
139.BR sigaction (2),
140.BR signal (2),
141.BR sigprocmask (2),
142.BR sigwaitinfo (2),
143.BR sigsetops (3),
7c85aa6b 144.BR sigwait (3),
924dca35 145.BR signal (7)