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