poll.2: Remove <signal.h>
[man-pages.git] / man3 / sigpause.3
blob91d9ff090675d6a66f0383e1a283c769a5c2b967
1 .\" Copyright (C) 2004 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH SIGPAUSE 3 2021-03-22 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 sigpause \- atomically release blocked signals and wait for interrupt
28 .SH SYNOPSIS
29 .nf
30 .B #include <signal.h>
31 .PP
32 .BI "int sigpause(int " sigmask ");  /* BSD (but see NOTES) */"
33 .PP
34 .BI "int sigpause(int " sig ");      /* System V / UNIX 95 */"
35 .fi
36 .SH DESCRIPTION
37 Don't use this function.
38 Use
39 .BR sigsuspend (2)
40 instead.
41 .PP
42 The function
43 .BR sigpause ()
44 is designed to wait for some signal.
45 It changes the process's signal mask (set of blocked signals),
46 and then waits for a signal to arrive.
47 Upon arrival of a signal, the original signal mask is restored.
48 .SH RETURN VALUE
50 .BR sigpause ()
51 returns, it was interrupted by a signal and the return value is \-1
52 with
53 .I errno
54 set to
55 .BR EINTR .
56 .SH ATTRIBUTES
57 For an explanation of the terms used in this section, see
58 .BR attributes (7).
59 .ad l
60 .nh
61 .TS
62 allbox;
63 lbx lb lb
64 l l l.
65 Interface       Attribute       Value
67 .BR sigpause ()
68 T}      Thread safety   MT-Safe
69 .TE
70 .hy
71 .ad
72 .sp 1
73 .\" FIXME: The marking is different from that in the glibc manual,
74 .\" marking in glibc manual is more detailed:
75 .\"
76 .\" sigpause: MT-Unsafe race:sigprocmask/!bsd!linux
77 .\"
78 .\" glibc manual says /!linux!bsd indicate the preceding marker only applies
79 .\" when the underlying kernel is neither Linux nor a BSD kernel.
80 .\" So, it is safe in Linux kernel.
81 .SH CONFORMING TO
82 The System V version of
83 .BR sigpause ()
84 is standardized in POSIX.1-2001.
85 It is also specified in POSIX.1-2008, where it is marked obsolete.
86 .SH NOTES
87 .SS History
88 The classical BSD version of this function appeared in 4.2BSD.
89 It sets the process's signal mask to
90 .IR sigmask .
91 UNIX 95 standardized the incompatible System V version of
92 this function, which removes only the specified signal
93 .I sig
94 from the process's signal mask.
95 .\" __xpg_sigpause: UNIX 95, spec 1170, SVID, SVr4, XPG
96 The unfortunate situation with two incompatible functions with the
97 same name was solved by the
98 .BR \%sigsuspend (2)
99 function, that takes a
100 .I "sigset_t\ *"
101 argument (instead of an
102 .IR int ).
103 .SS Linux notes
104 On Linux, this routine is a system call only on the Sparc (sparc64)
105 architecture.
107 .\" Libc4 and libc5 know only about the BSD version.
109 Glibc uses the BSD version if the
110 .B _BSD_SOURCE
111 feature test macro is defined and none of
112 .BR _POSIX_SOURCE ,
113 .BR _POSIX_C_SOURCE ,
114 .BR _XOPEN_SOURCE ,
115 .BR _GNU_SOURCE ,
117 .B _SVID_SOURCE
118 is defined.
119 Otherwise, the System V version is used,
120 and feature test macros must be defined as follows to obtain the declaration:
121 .IP * 3
122 Since glibc 2.26:
123 _XOPEN_SOURCE >= 500
124 .\" || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
125 .IP *
126 Glibc 2.25 and earlier: _XOPEN_SOURCE
128 Since glibc 2.19, only the System V version is exposed by
129 .IR <signal.h> ;
130 applications that formerly used the BSD
131 .BR sigpause ()
132 should be amended to use
133 .BR sigsuspend (2).
135 .\" For the BSD version, one usually uses a zero
136 .\" .I sigmask
137 .\" to indicate that no signals are to be blocked.
138 .SH SEE ALSO
139 .BR kill (2),
140 .BR sigaction (2),
141 .BR sigprocmask (2),
142 .BR sigsuspend (2),
143 .BR sigblock (3),
144 .BR sigvec (3),
145 .BR feature_test_macros (7)