Debian Codegraph @

upstream/debian-trixie/man2/sigpending.2

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