man-pages/man3/sigvec.3

258 lines
6.0 KiB
Groff
Raw Normal View History

2005-11-29 14:54:07 +00:00
'\" t
2007-09-20 06:52:22 +00:00
.\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com>
2005-11-29 14:54:07 +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
.\" the use of the information contained herein.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.TH SIGVEC 3 2007-07-26 "Linux" "Linux Programmer's Manual"
2005-11-29 14:54:07 +00:00
.SH NAME
sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD signal API
.SH SYNOPSIS
.B #include <signal.h>
.sp
.BI "int sigvec(int " sig ", struct sigvec *" vec ", struct sigvec *" ovec );
.sp
.BI "int sigmask(int " signum );
.sp
.BI "int sigblock(int " mask );
.sp
.BI "int sigsetmask(int " mask );
.sp
.B int siggetmask(void);
.sp
.in -4n
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.sp
All of the functions described on this page:
_BSD_SOURCE
.br
2005-11-29 14:54:07 +00:00
.SH DESCRIPTION
These functions are provided in glibc as a compatibility interface
for programs that make use of the historical BSD signal API.
This API is obsolete: new applications should use the POSIX signal API
.RB ( sigaction (2),
2005-11-29 14:54:07 +00:00
.BR sigprocmask (2),
etc.)
The
.BR sigvec ()
function sets and/or gets the disposition of the signal
.I sig
2005-11-29 14:54:07 +00:00
(like the POSIX
.BR sigaction (2)).
If
2005-11-29 14:54:07 +00:00
.I vec
is not NULL, it points to a
.I sigvec
structure that defines the new disposition for
2005-11-29 14:54:07 +00:00
.IR sig .
If
.I ovec
is not NULL, it points to a
2005-11-29 14:54:07 +00:00
.I sigvec
structure that is used to return the previous disposition of
.IR sig .
To obtain the current disposition of
2005-11-29 14:54:07 +00:00
.I sig
without changing it, specify NULL for
.IR vec ,
2005-11-29 14:54:07 +00:00
and a non-NULL pointer for
.IR ovec .
The dispositions for
.B SIGKILL
and
2005-11-29 14:54:07 +00:00
.B SIGSTOP
cannot be changed.
The
.I sigvec
structure has the following form:
.in +4n
2005-11-29 14:54:07 +00:00
.nf
struct sigvec {
void (*sv_handler)(); /* Signal disposition */
int sv_mask; /* Signals to be blocked in handler */
int sv_flags; /* Flags */
};
.fi
2007-07-09 21:52:33 +00:00
.in
2005-11-29 14:54:07 +00:00
The
.I sv_handler
field specifies the disposition of the signal, and is either:
the address of a signal handler function; or
.B SIG_DFL
meaning the default disposition applies for the signal; or
.B SIG_IGN
meaning that the signal is ignored.
If
.I sv_handler
specifies the address of a signal handler, then
.I sv_mask
specifies a mask of signals that are to be blocked while
2005-11-29 14:54:07 +00:00
the handler is executing.
In addition, the signal for which the handler is invoked is
2005-11-29 14:54:07 +00:00
also blocked by default.
Attempts to block
.B SIGKILL
or
2005-11-29 14:54:07 +00:00
.B SIGSTOP
are silently ignored.
If
.I sv_handler
specifies the address of a signal handler, then the
.I sv_flags
field specifies flags controlling what happens when the handler is called.
This field may contain zero or more of the following flags:
.TP
.B SV_INTERRUPT
If the signal handler interrupts a blocking system call,
then upon return from the handler the system call will not be restarted:
instead it will fail with the error
2007-06-20 22:20:03 +00:00
.BR EINTR .
If this flag is not specified, then system calls are restarted
2005-11-29 14:54:07 +00:00
by default.
.TP
.B SV_RESETHAND
Reset the disposition of the signal to the default
2005-11-29 14:54:07 +00:00
before calling the signal handler.
If this flag is not specified, then the handler remains established
until explicitly removed by a later call to
2005-11-29 14:54:07 +00:00
.BR sigvec ()
or until the process performs an
.BR execve (2).
.TP
.B SV_ONSTACK
Handle the signal on the alternate signal stack
(historically established under BSD using the obsolete
2005-11-29 14:54:07 +00:00
.BR sigstack ()
function; the POSIX replacement is
.BR sigaltstack (2)).
2005-11-29 14:54:07 +00:00
.PP
The
2005-11-29 14:54:07 +00:00
.BR sigmask ()
function constructs and returns a "signal mask" for
.IR signum .
For example, we can initialize the
.I vec.sv_mask
field given to
2005-11-29 14:54:07 +00:00
.BR sigvec ()
using code such as the following:
.nf
2007-04-05 12:36:57 +00:00
vec.sv_mask = sigmask(SIGQUIT) | sigpause(SIGABRT);
/* Block SIGQUIT and SIGABRT during
2005-11-29 14:54:07 +00:00
handler execution */
.fi
.PP
The
.BR sigblock ()
function adds the signals in
.I mask
to the process's signal mask
(like POSIX
2005-11-29 14:54:07 +00:00
.IR sigprocmask(SIG_BLOCK) ),
and returns the process's previous signal mask.
Attempts to block
.B SIGKILL
or
2005-11-29 14:54:07 +00:00
.B SIGSTOP
are silently ignored.
.PP
The
2005-11-29 14:54:07 +00:00
.BR sigsetmask ()
function sets the process's signal mask to the value given in
.I mask
(like POSIX
2005-11-29 14:54:07 +00:00
.IR sigprocmask(SIG_SETMASK) ),
and returns the process's previous signal mask.
.PP
The
.BR siggetmask ()
function returns the process's current signal mask.
This call is equivalent to
.IR sigblock(0) .
.SH RETURN VALUE
The
2005-11-29 14:54:07 +00:00
.BR sigvec ()
function returns 0 on success; on error, it returns \-1 and sets
.I errno
2005-11-29 14:54:07 +00:00
to indicate the error.
The
.BR sigblock ()
and
.BR sigsetmask ()
functions return the previous signal mask.
The
.BR sigmask ()
function returns the signal mask for
.IR signum .
.SH ERRORS
See the ERRORS under
.BR sigaction (2)
and
.BR sigprocmask (2).
.SH "CONFORMING TO"
All of these functions were in
4.3BSD, except
.BR siggetmask (),
whose origin is unclear.
These functions are obsolete: do not use them in new programs.
2005-11-29 14:54:07 +00:00
.SH NOTES
On 4.3BSD, the
.BR signal ()
function provided reliable semantics (as when calling
2005-11-29 14:54:07 +00:00
.BR sigvec ()
with
.I vec.sv_mask
equal to 0).
On System V,
.BR signal ()
provides unreliable semantics.
POSIX.1-2001 leaves these aspects of
2005-11-29 14:54:07 +00:00
.BR signal ()
unspecified.
See
2005-11-29 14:54:07 +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 14:54:07 +00:00
but this function has a different argument on the two systems.
See
.BR sigpause (3)
for details.
.SH "SEE ALSO"
.BR kill (2),
.BR pause (2),
.BR sigaction (2),
.BR signal (2),
.BR sigprocmask (2),
2005-11-29 15:24:57 +00:00
.BR raise (3),
2005-11-29 17:39:29 +00:00
.BR sigpause (3),
.BR sigset (3),
2005-11-29 14:54:07 +00:00
.BR signal (7)