OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man2 / sigsuspend.2
1 .\" Copyright (c) 2005 Michael Kerrisk
2 .\" based on earlier work by faith@cs.unc.edu and
3 .\" Mike Battersby <mib@deakin.edu.au>
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" 2005-09-15, mtk, Created new page by splitting off from sigaction.2
26 .\"
27 .TH SIGSUSPEND 2 2008-08-29 "Linux" "Linux Programmer's Manual"
28 .SH NAME
29 sigsuspend \- wait for a signal
30 .SH SYNOPSIS
31 .B #include <signal.h>
32 .sp
33 .BI "int sigsuspend(const sigset_t *" mask );
34 .sp
35 .in -4n
36 Feature Test Macro Requirements for glibc (see
37 .BR feature_test_macros (7)):
38 .in
39 .sp
40 .ad l
41 .BR sigsuspend ():
42 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
43 .ad b
44 .SH DESCRIPTION
45 .BR sigsuspend ()
46 temporarily replaces the signal mask of the calling process with the
47 mask given by
48 .I mask
49 and then suspends the process until delivery of a signal whose
50 action is to invoke a signal handler or to terminate a process.
51
52 If the signal terminates the process, then
53 .BR sigsuspend ()
54 does not return.
55 If the signal is caught, then
56 .BR sigsuspend ()
57 returns after the signal handler returns,
58 and the signal mask is restored to the state before the call to
59 .BR sigsuspend ().
60
61 It is not possible to block
62 .B SIGKILL
63 or
64 .BR SIGSTOP ;
65 specifying these signals in
66 .IR mask ,
67 has no effect on the process's signal mask.
68 .SH "RETURN VALUE"
69 .BR sigsuspend ()
70 always returns \-1, normally with the error
71 .BR EINTR .
72 .SH ERRORS
73 .TP
74 .B EFAULT
75 .I mask
76 points to memory which is not a valid part of the process address space.
77 .TP
78 .B EINTR
79 The call was interrupted by a signal.
80 .SH "CONFORMING TO"
81 POSIX.1-2001.
82 .SH NOTES
83 .PP
84 Normally,
85 .BR sigsuspend ()
86 is used in conjunction with
87 .BR sigprocmask (2)
88 in order to prevent delivery of a signal during the execution of a
89 critical code section.
90 The caller first blocks the signals with
91 .BR sigprocmask (2).
92 When the critical code has completed, the caller then waits for the
93 signals by calling
94 .BR sigsuspend ()
95 with the signal mask that was returned by
96 .BR sigprocmask (2)
97 (in the
98 .I oldset
99 argument).
100 .PP
101 See
102 .BR sigsetops (3)
103 for details on manipulating signal sets.
104 .SH "SEE ALSO"
105 .BR kill (2),
106 .BR pause (2),
107 .BR sigaction (2),
108 .BR signal (2),
109 .BR sigprocmask (2),
110 .BR sigwaitinfo (2),
111 .BR sigsetops (3),
112 .BR sigwait (3),
113 .BR signal (7)