Blame man2/sigpending.2

Packit 7cfc04
.\" Copyright (c) 2005 Michael Kerrisk
Packit 7cfc04
.\" based on earlier work by faith@cs.unc.edu and
Packit 7cfc04
.\" Mike Battersby <mib@deakin.edu.au>
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(VERBATIM)
Packit 7cfc04
.\" Permission is granted to make and distribute verbatim copies of this
Packit 7cfc04
.\" manual provided the copyright notice and this permission notice are
Packit 7cfc04
.\" preserved on all copies.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Permission is granted to copy and distribute modified versions of this
Packit 7cfc04
.\" manual under the conditions for verbatim copying, provided that the
Packit 7cfc04
.\" entire resulting derived work is distributed under the terms of a
Packit 7cfc04
.\" permission notice identical to this one.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Since the Linux kernel and libraries are constantly changing, this
Packit 7cfc04
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
Packit 7cfc04
.\" responsibility for errors or omissions, or for damages resulting from
Packit 7cfc04
.\" the use of the information contained herein.  The author(s) may not
Packit 7cfc04
.\" have taken the same level of care in the production of this manual,
Packit 7cfc04
.\" which is licensed free of charge, as they might when working
Packit 7cfc04
.\" professionally.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Formatted or processed versions of this manual, if unaccompanied by
Packit 7cfc04
.\" the source, must acknowledge the copyright and authors of this work.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\" 2005-09-15, mtk, Created new page by splitting off from sigaction.2
Packit 7cfc04
.\"
Packit 7cfc04
.TH SIGPENDING 2 2017-09-15 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
sigpending, rt_sigpending \- examine pending signals
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.B #include <signal.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int sigpending(sigset_t *" set );
Packit 7cfc04
.PP
Packit 7cfc04
.in -4n
Packit 7cfc04
Feature Test Macro Requirements for glibc (see
Packit 7cfc04
.BR feature_test_macros (7)):
Packit 7cfc04
.in
Packit 7cfc04
.PP
Packit 7cfc04
.ad l
Packit 7cfc04
.BR sigpending ():
Packit 7cfc04
_POSIX_C_SOURCE
Packit 7cfc04
.ad b
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
.PP
Packit 7cfc04
.BR sigpending ()
Packit 7cfc04
returns the set of signals that are pending for delivery to the calling
Packit 7cfc04
thread (i.e., the signals which have been raised while blocked).
Packit 7cfc04
The mask of pending signals is returned in
Packit 7cfc04
.IR set .
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
.BR sigpending ()
Packit 7cfc04
returns 0 on success and \-1 on error.
Packit 7cfc04
In the event of an error,
Packit 7cfc04
.I errno
Packit 7cfc04
is set to indicate the cause.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
.TP
Packit 7cfc04
.B EFAULT
Packit 7cfc04
.I set
Packit 7cfc04
points to memory which is not a valid part of the process address space.
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
POSIX.1-2001, POSIX.1-2008.
Packit 7cfc04
.SH NOTES
Packit 7cfc04
See
Packit 7cfc04
.BR sigsetops (3)
Packit 7cfc04
for details on manipulating signal sets.
Packit 7cfc04
.PP
Packit 7cfc04
If a signal is both blocked and has a disposition of "ignored", it is
Packit 7cfc04
.I not
Packit 7cfc04
added to the mask of pending signals when generated.
Packit 7cfc04
.PP
Packit 7cfc04
The set of signals that is pending for a thread
Packit 7cfc04
is the union of the set of signals that is pending for that thread
Packit 7cfc04
and the set of signals that is pending for the process as a whole; see
Packit 7cfc04
.BR signal (7).
Packit 7cfc04
.PP
Packit 7cfc04
A child created via
Packit 7cfc04
.BR fork (2)
Packit 7cfc04
initially has an empty pending signal set;
Packit 7cfc04
the pending signal set is preserved across an
Packit 7cfc04
.BR execve (2).
Packit 7cfc04
.\"
Packit 7cfc04
.SS C library/kernel differences
Packit 7cfc04
The original Linux system call was named
Packit 7cfc04
.BR sigpending ().
Packit 7cfc04
However, with the addition of real-time signals in Linux 2.2,
Packit 7cfc04
the fixed-size, 32-bit
Packit 7cfc04
.IR sigset_t
Packit 7cfc04
argument supported by that system call was no longer fit for purpose.
Packit 7cfc04
Consequently, a new system call,
Packit 7cfc04
.BR rt_sigpending (),
Packit 7cfc04
was added to support an enlarged
Packit 7cfc04
.IR sigset_t
Packit 7cfc04
type.
Packit 7cfc04
The new system call takes a second argument,
Packit 7cfc04
.IR "size_t sigsetsize" ,
Packit 7cfc04
which specifies the size in bytes of the signal set in
Packit 7cfc04
.IR set .
Packit 7cfc04
.\" This argument is currently required to be less than or equal to
Packit 7cfc04
.\" .IR sizeof(sigset_t)
Packit 7cfc04
.\" (or the error
Packit 7cfc04
.\" .B EINVAL
Packit 7cfc04
.\" results).
Packit 7cfc04
The glibc
Packit 7cfc04
.BR sigpending ()
Packit 7cfc04
wrapper function hides these details from us, transparently calling
Packit 7cfc04
.BR rt_sigpending ()
Packit 7cfc04
when the kernel provides it.
Packit 7cfc04
.\"
Packit 7cfc04
.SH BUGS
Packit 7cfc04
In versions of glibc up to and including 2.2.1,
Packit 7cfc04
there is a bug in the wrapper function for
Packit 7cfc04
.BR sigpending ()
Packit 7cfc04
which means that information about pending real-time signals
Packit 7cfc04
is not correctly returned.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR kill (2),
Packit 7cfc04
.BR sigaction (2),
Packit 7cfc04
.BR signal (2),
Packit 7cfc04
.BR sigprocmask (2),
Packit 7cfc04
.BR sigsuspend (2),
Packit 7cfc04
.BR sigsetops (3),
Packit 7cfc04
.BR signal (7)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.