2005-11-29 17:40:16 +00:00
|
|
|
'\" t
|
2007-09-20 06:52:22 +00:00
|
|
|
.\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com>
|
2005-11-29 17:40:16 +00:00
|
|
|
.\"
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
|
|
|
.\"
|
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
2008-03-18 14:47:54 +00:00
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
2005-11-29 17:40:16 +00:00
|
|
|
.\"
|
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\"
|
_exit.2, brk.2, capget.2, chdir.2, chmod.2, chown.2, chroot.2, getdtablesize.2, gethostname.2, getpagesize.2, getsid.2, killpg.2, mknod.2, mknodat.2, poll.2, posix_fadvise.2, pread.2, readlink.2, setpgid.2, setreuid.2, sigaltstack.2, stat.2, symlink.2, sync.2, truncate.2, vfork.2, wait.2, wait4.2, a64l.3, abs.3, acos.3, acosh.3, asin.3, asinh.3, atan.3, atan2.3, atoi.3, cbrt.3, ceil.3, copysign.3, cosh.3, dirfd.3, div.3, ecvt.3, erf.3, erfc.3, exp.3, exp2.3, fabs.3, fdim.3, ffs.3, floor.3, fma.3, fmax.3, fmin.3, fmod.3, fpclassify.3, frexp.3, ftw.3, fwide.3, gcvt.3, getcwd.3, getdate.3, getgrent.3, gethostid.3, getpass.3, getpwent.3, getsubopt.3, getw.3, hypot.3, ilogb.3, index.3, isalpha.3, isgreater.3, iswblank.3, j0.3, ldexp.3, lockf.3, log.3, log10.3, log1p.3, logb.3, lrint.3, lround.3, mkstemp.3, mktemp.3, modf.3, mq_receive.3, mq_send.3, nan.3, nextafter.3, posix_fallocate.3, posix_memalign.3, printf.3, qecvt.3, random.3, realpath.3, remainder.3, remquo.3, rint.3, round.3, scalb.3, scalbln.3, scanf.3, siginterrupt.3, signbit.3, sigset.3, sinh.3, sqrt.3, strcasecmp.3, strcat.3, strchr.3, strcmp.3, strcoll.3, strcpy.3, strfry.3, strpbrk.3, strsep.3, strspn.3, strstr.3, strtod.3, strtok.3, strtol.3, strtoul.3, strxfrm.3, tanh.3, tgamma.3, trunc.3, ttyslot.3, ualarm.3, usleep.3, wprintf.3, armscii-8.7, cp1251.7, iso_8859-10.7, iso_8859-11.7, iso_8859-13.7, iso_8859-14.7, iso_8859-3.7, iso_8859-5.7, iso_8859-6.7, iso_8859-8.7, koi8-u.7: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-09-19 17:19:13 +00:00
|
|
|
.TH SIGSET 3 2010-09-20 "Linux" "Linux Programmer's Manual"
|
2005-11-29 17:40:16 +00:00
|
|
|
.SH NAME
|
|
|
|
sigset, sighold, sigrelse, sigignore \- System V signal API
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B #include <signal.h>
|
|
|
|
.sp
|
|
|
|
.B typedef void (*sighandler_t)(int);
|
|
|
|
.sp
|
|
|
|
.BI "sighandler_t sigset(int " sig ", sighandler_t " disp );
|
|
|
|
.sp
|
|
|
|
.BI "int sighold(int " sig );
|
|
|
|
.sp
|
|
|
|
.BI "int sigrelse(int " sig );
|
|
|
|
.sp
|
|
|
|
.BI "int sigignore(int " sig );
|
2010-09-18 07:44:42 +00:00
|
|
|
.sp
|
|
|
|
.in -4n
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
|
|
.BR feature_test_macros (7)):
|
|
|
|
.in
|
|
|
|
.sp
|
|
|
|
.ad l
|
|
|
|
.BR sigset (),
|
|
|
|
.BR sighold (),
|
|
|
|
.BR sigrelse (),
|
|
|
|
.BR sigignore ():
|
|
|
|
.br
|
|
|
|
.RS 4
|
|
|
|
_XOPEN_SOURCE\ >=\ 500 ||
|
|
|
|
_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
|
|
|
|
.RE
|
|
|
|
.ad
|
2005-11-29 17:40:16 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
These functions are provided in glibc as a compatibility interface
|
|
|
|
for programs that make use of the historical System V signal API.
|
2007-04-12 22:42:49 +00:00
|
|
|
This API is obsolete: new applications should use the POSIX signal API
|
|
|
|
.RB ( sigaction (2),
|
2005-11-29 17:40:16 +00:00
|
|
|
.BR sigprocmask (2),
|
|
|
|
etc.)
|
|
|
|
|
|
|
|
The
|
|
|
|
.BR sigset ()
|
|
|
|
function modifies the disposition of the signal
|
|
|
|
.IR sig .
|
2007-04-12 22:42:49 +00:00
|
|
|
The
|
2005-11-29 17:40:16 +00:00
|
|
|
.I disp
|
|
|
|
argument can be the address of a signal handler function,
|
|
|
|
or one of the following constants:
|
|
|
|
.TP
|
2007-09-20 16:26:31 +00:00
|
|
|
.B SIG_DFL
|
2005-11-29 17:40:16 +00:00
|
|
|
Reset the disposition of
|
|
|
|
.I sig
|
|
|
|
to the default.
|
|
|
|
.TP
|
2007-09-20 16:26:31 +00:00
|
|
|
.B SIG_IGN
|
2005-11-29 17:40:16 +00:00
|
|
|
Ignore
|
|
|
|
.IR sig .
|
|
|
|
.TP
|
2007-09-20 16:26:31 +00:00
|
|
|
.B SIG_HOLD
|
2007-04-12 22:42:49 +00:00
|
|
|
Add
|
2005-11-29 17:40:16 +00:00
|
|
|
.I sig
|
|
|
|
to the process's signal mask, but leave the disposition of
|
|
|
|
.I sig
|
|
|
|
unchanged.
|
|
|
|
.PP
|
2007-04-12 22:42:49 +00:00
|
|
|
If
|
2005-11-29 17:40:16 +00:00
|
|
|
.I disp
|
|
|
|
specifies the address of a signal handler, then
|
|
|
|
.I sig
|
|
|
|
is added to the process's signal mask during execution of the handler.
|
|
|
|
.PP
|
|
|
|
If
|
|
|
|
.I disp
|
|
|
|
was specified as a value other than
|
2005-11-29 17:59:53 +00:00
|
|
|
.BR SIG_HOLD ,
|
|
|
|
then
|
2005-11-29 17:40:16 +00:00
|
|
|
.I sig
|
|
|
|
is removed from the process's signal mask.
|
|
|
|
.PP
|
|
|
|
The dispositions for
|
|
|
|
.B SIGKILL
|
2007-04-12 22:42:49 +00:00
|
|
|
and
|
2005-11-29 17:40:16 +00:00
|
|
|
.B SIGSTOP
|
|
|
|
cannot be changed.
|
|
|
|
.PP
|
2007-04-12 22:42:49 +00:00
|
|
|
The
|
2005-11-29 17:40:16 +00:00
|
|
|
.BR sighold ()
|
2007-04-12 22:42:49 +00:00
|
|
|
function adds
|
2005-11-29 17:40:16 +00:00
|
|
|
.I sig
|
|
|
|
to the calling process's signal mask.
|
|
|
|
|
|
|
|
The
|
|
|
|
.BR sigrelse ()
|
|
|
|
function removes
|
|
|
|
.I sig
|
|
|
|
from the calling process's signal mask.
|
|
|
|
|
|
|
|
The
|
|
|
|
.BR sigignore ()
|
2006-07-20 13:53:47 +00:00
|
|
|
function sets the disposition of
|
2005-11-29 17:40:16 +00:00
|
|
|
.I sig
|
|
|
|
to
|
|
|
|
.BR SIG_IGN .
|
|
|
|
.SH RETURN VALUE
|
|
|
|
On success,
|
|
|
|
.BR sigset ()
|
|
|
|
returns
|
|
|
|
.B SIG_HOLD
|
2007-04-12 22:42:49 +00:00
|
|
|
if
|
|
|
|
.I sig
|
2005-11-29 17:40:16 +00:00
|
|
|
was blocked before the call,
|
|
|
|
or the signal's previous disposition
|
|
|
|
if it was not blocked before the call.
|
|
|
|
On error,
|
|
|
|
.BR sigset ()
|
2007-04-12 22:42:49 +00:00
|
|
|
returns \-1, with
|
2005-11-29 17:40:16 +00:00
|
|
|
.I errno
|
|
|
|
set to indicate the error.
|
2007-10-16 05:56:38 +00:00
|
|
|
(But see BUGS below.)
|
2005-11-29 17:59:53 +00:00
|
|
|
|
2005-11-29 17:40:16 +00:00
|
|
|
The
|
|
|
|
.BR sighold (),
|
|
|
|
.BR sigrelse (),
|
|
|
|
and
|
|
|
|
.BR sigignore ()
|
|
|
|
functions return 0 on success; on error, these functions return \-1 and set
|
2007-04-12 22:42:49 +00:00
|
|
|
.I errno
|
2005-11-29 17:40:16 +00:00
|
|
|
to indicate the error.
|
|
|
|
.SH ERRORS
|
|
|
|
For
|
|
|
|
.BR sigset ()
|
|
|
|
see the ERRORS under
|
|
|
|
.BR sigaction (2)
|
|
|
|
and
|
|
|
|
.BR sigprocmask (2).
|
|
|
|
|
|
|
|
For
|
|
|
|
.BR sighold ()
|
|
|
|
and
|
|
|
|
.BR sigrelse ()
|
|
|
|
see the ERRORS under
|
|
|
|
.BR sigprocmask (2).
|
|
|
|
|
2007-04-12 22:42:49 +00:00
|
|
|
For
|
2005-11-29 17:40:16 +00:00
|
|
|
.BR sigignore (),
|
|
|
|
see the errors under
|
|
|
|
.BR sigaction (2).
|
2007-05-19 04:30:20 +00:00
|
|
|
.SH "CONFORMING TO"
|
|
|
|
SVr4, POSIX.1-2001.
|
|
|
|
These functions are obsolete: do not use them in new programs.
|
2008-08-06 12:34:50 +00:00
|
|
|
POSIX.1-2008 marks
|
|
|
|
.BR sighold (),
|
|
|
|
.BR sigignore (),
|
|
|
|
.BR sigpause (),
|
|
|
|
.BR sigrelse (),
|
|
|
|
and
|
|
|
|
.BR sigset ()
|
2009-03-14 18:58:46 +00:00
|
|
|
as obsolete, recommending the use of
|
|
|
|
.BR sigaction (2),
|
|
|
|
.BR sigprocmask (2),
|
|
|
|
.BR pthread_sigmask (3),
|
|
|
|
and
|
|
|
|
.BR sigsuspend (2)
|
|
|
|
instead.
|
2005-11-29 17:40:16 +00:00
|
|
|
.SH NOTES
|
2005-11-30 13:33:11 +00:00
|
|
|
These functions appeared in glibc version 2.1.
|
|
|
|
|
2005-11-29 17:40:16 +00:00
|
|
|
The
|
|
|
|
.I sighandler_t
|
|
|
|
type is a GNU extension; it is only used on this page to make the
|
|
|
|
.BR sigset ()
|
|
|
|
prototype more easily readable.
|
|
|
|
|
|
|
|
The
|
|
|
|
.BR sigset ()
|
2007-04-12 22:42:49 +00:00
|
|
|
function provides reliable signal handling semantics (as when calling
|
2007-05-12 00:30:29 +00:00
|
|
|
.BR sigaction (2)
|
2005-11-29 17:40:16 +00:00
|
|
|
with
|
|
|
|
.I sa_mask
|
2005-11-29 17:59:53 +00:00
|
|
|
equal to 0).
|
2005-11-29 17:40:16 +00:00
|
|
|
|
|
|
|
On System V, the
|
|
|
|
.BR signal ()
|
2007-04-12 22:42:49 +00:00
|
|
|
function provides unreliable semantics (as when calling
|
2007-05-12 00:30:29 +00:00
|
|
|
.BR sigaction (2)
|
2005-11-29 17:40:16 +00:00
|
|
|
with
|
|
|
|
.I sa_mask
|
2007-04-12 22:42:49 +00:00
|
|
|
equal to
|
2005-11-29 17:40:16 +00:00
|
|
|
.IR "SA_RESETHAND | SA_NODEFER" ).
|
2007-04-12 22:42:49 +00:00
|
|
|
On BSD,
|
2005-11-29 17:40:16 +00:00
|
|
|
.BR signal ()
|
|
|
|
provides reliable semantics.
|
2007-04-12 22:42:49 +00:00
|
|
|
POSIX.1-2001 leaves these aspects of
|
2005-11-29 17:40:16 +00:00
|
|
|
.BR signal ()
|
|
|
|
unspecified.
|
2007-04-12 22:42:49 +00:00
|
|
|
See
|
2005-11-29 17:40:16 +00:00
|
|
|
.BR signal (2)
|
|
|
|
for further details.
|
|
|
|
|
|
|
|
In order to wait for a signal,
|
|
|
|
BSD and System V both provided a function named
|
2007-07-08 14:59:09 +00:00
|
|
|
.BR sigpause (3),
|
2005-11-29 17:40:16 +00:00
|
|
|
but this function has a different argument on the two systems.
|
|
|
|
See
|
|
|
|
.BR sigpause (3)
|
|
|
|
for details.
|
2005-11-30 13:33:11 +00:00
|
|
|
.SH BUGS
|
|
|
|
In versions of glibc before 2.2,
|
|
|
|
.BR sigset ()
|
2007-04-12 22:42:49 +00:00
|
|
|
did not unblock
|
2005-11-30 13:33:11 +00:00
|
|
|
.I sig
|
2007-04-12 22:42:49 +00:00
|
|
|
if
|
2005-11-30 13:33:11 +00:00
|
|
|
.I disp
|
|
|
|
was specified as a value other than
|
|
|
|
.BR SIG_HOLD .
|
|
|
|
|
2007-10-16 05:53:44 +00:00
|
|
|
In versions of glibc before 2.5,
|
2005-11-30 13:33:11 +00:00
|
|
|
.BR sigset ()
|
2007-04-12 22:42:49 +00:00
|
|
|
does not correctly return the previous disposition of the signal
|
2005-11-30 13:33:11 +00:00
|
|
|
in two cases.
|
|
|
|
First, if
|
|
|
|
.I disp
|
2007-04-12 22:42:49 +00:00
|
|
|
is specified as
|
2005-11-30 13:33:11 +00:00
|
|
|
.BR SIG_HOLD ,
|
|
|
|
then a successful
|
|
|
|
.BR sigset ()
|
|
|
|
always returns
|
|
|
|
.BR SIG_HOLD .
|
|
|
|
Instead, it should return the previous disposition of the signal
|
|
|
|
(unless the signal was blocked, in which case
|
2007-09-20 16:26:31 +00:00
|
|
|
.B SIG_HOLD
|
2005-11-30 13:33:11 +00:00
|
|
|
should be returned).
|
|
|
|
Second, if the signal is currently blocked, then
|
|
|
|
the return value of a successful
|
|
|
|
.BR sigset ()
|
|
|
|
should be
|
|
|
|
.BR SIG_HOLD .
|
|
|
|
Instead, the previous disposition of the signal is returned.
|
2007-10-16 05:53:44 +00:00
|
|
|
These problems have been fixed since glibc 2.5.
|
2005-11-30 13:33:11 +00:00
|
|
|
.\" See http://sourceware.org/bugzilla/show_bug.cgi?id=1951
|
2005-11-29 17:40:16 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR kill (2),
|
|
|
|
.BR pause (2),
|
|
|
|
.BR sigaction (2),
|
|
|
|
.BR signal (2),
|
|
|
|
.BR sigprocmask (2),
|
|
|
|
.BR raise (3),
|
|
|
|
.BR sigpause (3),
|
|
|
|
.BR sigvec (3),
|
2007-01-28 20:00:24 +00:00
|
|
|
.BR feature_test_macros (7),
|
2005-11-29 17:40:16 +00:00
|
|
|
.BR signal (7)
|