OSDN Git Service

8acff0645f53e56ac7f83ed39bfc9aed3df235e4
[linuxjm/LDP_man-pages.git] / original / man3 / sigpause.3
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 2014-01-07 "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 .sp
32 .BI "int sigpause(int " sigmask ");  /* BSD (but see NOTES) */"
33 .sp
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 .LP
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
49 If
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 .SS Multithreading (see pthreads(7))
58 The
59 .BR sigpause ()
60 function is thread-safe.
61 .SH CONFORMING TO
62 The System V version of
63 .BR sigpause ()
64 is standardized in POSIX.1-2001.
65 .SH NOTES
66 .SS History
67 The classical BSD version of this function appeared in 4.2BSD.
68 It sets the process's signal mask to
69 .IR sigmask .
70 UNIX 95 standardized the incompatible System V version of
71 this function, which removes only the specified signal
72 .I sig
73 from the process's signal mask.
74 .\" __xpg_sigpause: UNIX 95, spec 1170, SVID, SVr4, XPG
75 The unfortunate situation with two incompatible functions with the
76 same name was solved by the
77 .BR \%sigsuspend (2)
78 function, that takes a
79 .I "sigset_t\ *"
80 argument (instead of an
81 .IR int ).
82 .SS Linux notes
83 On Linux, this routine is a system call only on the Sparc (sparc64)
84 architecture.
85
86 Libc4 and libc5 know only about the BSD version.
87
88 Glibc uses the BSD version if the
89 .B _BSD_SOURCE
90 feature test macro is defined and none of
91 .BR _POSIX_SOURCE ,
92 .BR _POSIX_C_SOURCE ,
93 .BR _XOPEN_SOURCE ,
94 .BR _GNU_SOURCE ,
95 or
96 .B _SVID_SOURCE
97 is defined.
98 Otherwise, the System V version is used (and
99 .BR _XOPEN_SOURCE
100 must be defined to obtain the declaration).
101 Since glibc 2.19, only the System V version is exposed by
102 .IR <signal.h> ;
103 applications that formerly used the BSD
104 .BR sigpause ()
105 should be amended to use
106 .BR sigsuspend (2).
107 .\"
108 .\" For the BSD version, one usually uses a zero
109 .\" .I sigmask
110 .\" to indicate that no signals are to be blocked.
111 .SH SEE ALSO
112 .BR kill (2),
113 .BR sigaction (2),
114 .BR sigprocmask (2),
115 .BR sigsuspend (2),
116 .BR sigblock (3),
117 .BR sigvec (3),
118 .BR feature_test_macros (7)
119 .SH COLOPHON
120 This page is part of release 3.67 of the Linux
121 .I man-pages
122 project.
123 A description of the project,
124 information about reporting bugs,
125 and the latest version of this page,
126 can be found at
127 \%http://www.kernel.org/doc/man\-pages/.