rename.2: wfix
[man-pages.git] / man2 / sigpending.2
blob4405ffc9c648c166e47b2703758f7f7da102bdd7
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 .\" %%%LICENSE_START(VERBATIM)
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.
14 .\"
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.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .\" 2005-09-15, mtk, Created new page by splitting off from sigaction.2
28 .\"
29 .TH SIGPENDING 2 2021-03-22 "Linux" "Linux Programmer's Manual"
30 .SH NAME
31 sigpending, rt_sigpending \- examine pending signals
32 .SH SYNOPSIS
33 .nf
34 .B #include <signal.h>
35 .PP
36 .BI "int sigpending(sigset_t *" set );
37 .fi
38 .PP
39 .RS -4
40 Feature Test Macro Requirements for glibc (see
41 .BR feature_test_macros (7)):
42 .RE
43 .PP
44 .BR sigpending ():
45 .nf
46     _POSIX_C_SOURCE
47 .fi
48 .SH DESCRIPTION
49 .BR sigpending ()
50 returns the set of signals that are pending for delivery to the calling
51 thread (i.e., the signals which have been raised while blocked).
52 The mask of pending signals is returned in
53 .IR set .
54 .SH RETURN VALUE
55 .BR sigpending ()
56 returns 0 on success.
57 On failure, \-1 is returned and
58 .I errno
59 is set to indicate the error.
60 .SH ERRORS
61 .TP
62 .B EFAULT
63 .I set
64 points to memory which is not a valid part of the process address space.
65 .SH CONFORMING TO
66 POSIX.1-2001, POSIX.1-2008.
67 .SH NOTES
68 See
69 .BR sigsetops (3)
70 for details on manipulating signal sets.
71 .PP
72 If a signal is both blocked and has a disposition of "ignored", it is
73 .I not
74 added to the mask of pending signals when generated.
75 .PP
76 The set of signals that is pending for a thread
77 is the union of the set of signals that is pending for that thread
78 and the set of signals that is pending for the process as a whole; see
79 .BR signal (7).
80 .PP
81 A child created via
82 .BR fork (2)
83 initially has an empty pending signal set;
84 the pending signal set is preserved across an
85 .BR execve (2).
86 .\"
87 .SS C library/kernel differences
88 The original Linux system call was named
89 .BR sigpending ().
90 However, with the addition of real-time signals in Linux 2.2,
91 the fixed-size, 32-bit
92 .IR sigset_t
93 argument supported by that system call was no longer fit for purpose.
94 Consequently, a new system call,
95 .BR rt_sigpending (),
96 was added to support an enlarged
97 .IR sigset_t
98 type.
99 The new system call takes a second argument,
100 .IR "size_t sigsetsize" ,
101 which specifies the size in bytes of the signal set in
102 .IR set .
103 .\" This argument is currently required to be less than or equal to
104 .\" .IR sizeof(sigset_t)
105 .\" (or the error
106 .\" .B EINVAL
107 .\" results).
108 The glibc
109 .BR sigpending ()
110 wrapper function hides these details from us, transparently calling
111 .BR rt_sigpending ()
112 when the kernel provides it.
114 .SH BUGS
115 In versions of glibc up to and including 2.2.1,
116 there is a bug in the wrapper function for
117 .BR sigpending ()
118 which means that information about pending real-time signals
119 is not correctly returned.
120 .SH SEE ALSO
121 .BR kill (2),
122 .BR sigaction (2),
123 .BR signal (2),
124 .BR sigprocmask (2),
125 .BR sigsuspend (2),
126 .BR sigsetops (3),
127 .BR signal (7)