Debian Codegraph @

upstream/debian-unstable/man2/sigpending.2

raw
1 .\" Copyright 2005, Michael Kerrisk <[email protected]>
2 .\" Copyright, the authors of the Linux man-pages project
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH sigpending 2 2026-02-08 "Linux man-pages 6.18"
7 .SH NAME
8 sigpending, rt_sigpending \- examine pending signals
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ,\~ \-lc )
12 .SH SYNOPSIS
13 .nf
14 .B #include <signal.h>
15 .P
16 .BI "int sigpending(sigset_t *" set );
17 .fi
18 .P
19 .RS -4
20 Feature Test Macro Requirements for glibc (see
21 .BR feature_test_macros (7)):
22 .RE
23 .P
24 .BR sigpending ():
25 .nf
26 _POSIX_C_SOURCE
27 .fi
28 .SH DESCRIPTION
29 .BR sigpending ()
30 returns the set of signals that are pending for delivery to the calling
31 thread (i.e., the signals which have been raised while blocked).
32 The mask of pending signals is returned in
33 .IR set .
34 .SH RETURN VALUE
35 .BR sigpending ()
36 returns 0 on success.
37 On failure, \-1 is returned and
38 .I errno
39 is set to indicate the error.
40 .SH ERRORS
41 .TP
42 .B EFAULT
43 .I set
44 points to memory which is not a valid part of the process address space.
45 .SH STANDARDS
46 POSIX.1-2024.
47 .SH HISTORY
48 POSIX.1-2001.
49 .SS C library/kernel differences
50 The original Linux system call was named
51 .BR sigpending ().
52 However, with the addition of real-time signals in Linux 2.2,
53 the fixed-size, 32-bit
54 .I sigset_t
55 argument supported by that system call was no longer fit for purpose.
56 Consequently, a new system call,
57 .BR rt_sigpending (),
58 was added to support an enlarged
59 .I sigset_t
60 type.
61 The new system call takes a second argument,
62 .IR "size_t sigsetsize" ,
63 which specifies the size in bytes of the signal set in
64 .IR set .
65 .\" This argument is currently required to be less than or equal to
66 .\" .IR sizeof(sigset_t)
67 .\" (or the error
68 .\" .B EINVAL
69 .\" results).
70 The glibc
71 .BR sigpending ()
72 wrapper function hides these details from us, transparently calling
73 .BR rt_sigpending ()
74 when the kernel provides it.
75 .SH NOTES
76 See
77 .BR sigsetops (3)
78 for details on manipulating signal sets.
79 .P
80 If a signal is both blocked and has a disposition of "ignored", it is
81 .I not
82 added to the mask of pending signals when generated.
83 .P
84 The set of signals that is pending for a thread
85 is the union of the set of signals that is pending for that thread
86 and the set of signals that is pending for the process as a whole;
87 see
88 .BR signal (7).
89 .P
90 A child created via
91 .BR fork (2)
92 initially has an empty pending signal set;
93 the pending signal set is preserved across an
94 .BR execve (2).
95 .SH BUGS
96 Up to and including glibc 2.2.1,
97 there is a bug in the wrapper function for
98 .BR sigpending ()
99 which means that information about pending real-time signals
100 is not correctly returned.
101 .SH SEE ALSO
102 .BR kill (2),
103 .BR sigaction (2),
104 .BR signal (2),
105 .BR sigprocmask (2),
106 .BR sigsuspend (2),
107 .BR sigsetops (3),
108 .BR signal (7)