117 lines
3.2 KiB
Groff
117 lines
3.2 KiB
Groff
|
.\" $NetBSD: raise_default_signal.3,v 1.2 2008/04/30 13:10:52 martin Exp $
|
||
|
.\"
|
||
|
.\" Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||
|
.\" All rights reserved.
|
||
|
.\"
|
||
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
||
|
.\" by Luke Mewburn.
|
||
|
.\"
|
||
|
.\" Redistribution and use in source and binary forms, with or without
|
||
|
.\" modification, are permitted provided that the following conditions
|
||
|
.\" are met:
|
||
|
.\" 1. Redistributions of source code must retain the above copyright
|
||
|
.\" notice, this list of conditions and the following disclaimer.
|
||
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||
|
.\" notice, this list of conditions and the following disclaimer in the
|
||
|
.\" documentation and/or other materials provided with the distribution.
|
||
|
.\"
|
||
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||
|
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||
|
.\"
|
||
|
.Dd September 25, 2007
|
||
|
.Dt RAISE_DEFAULT_SIGNAL 3
|
||
|
.Os
|
||
|
.Sh NAME
|
||
|
.Nm raise_default_signal
|
||
|
.Nd raise the default signal handler
|
||
|
.Sh LIBRARY
|
||
|
.Lb libutil
|
||
|
.Sh SYNOPSIS
|
||
|
.In util.h
|
||
|
.Ft int
|
||
|
.Fo raise_default_signal
|
||
|
.Fa "int sig"
|
||
|
.Fc
|
||
|
.Sh DESCRIPTION
|
||
|
The
|
||
|
.Fn raise_default_signal
|
||
|
function raises the default signal handler for the signal
|
||
|
.Fa sig .
|
||
|
This function may be used by a user-defined signal handler router
|
||
|
to ensure that a parent process receives the correct notification
|
||
|
of a process termination by a signal.
|
||
|
This can be used to avoid a common programming mistake
|
||
|
when terminating a process from a custom
|
||
|
.Dv SIGINT
|
||
|
or
|
||
|
.Dv SIGQUIT
|
||
|
signal handler.
|
||
|
.Pp
|
||
|
The operations performed are:
|
||
|
.Bl -enum -offset indent
|
||
|
.It
|
||
|
Block all signals, using
|
||
|
.Xr sigprocmask 3 .
|
||
|
.It
|
||
|
Set the signal handler for signal
|
||
|
.Fa sig
|
||
|
to the default signal handler
|
||
|
.Dv ( SIG_DFL ) .
|
||
|
.It
|
||
|
.Xr raise 3
|
||
|
signal
|
||
|
.Fa sig .
|
||
|
.It
|
||
|
Unblock signal
|
||
|
.Fa sig
|
||
|
to deliver it.
|
||
|
.It
|
||
|
Restore the original signal mask and handler,
|
||
|
even if there was a failure.
|
||
|
.El
|
||
|
.Pp
|
||
|
See
|
||
|
.Xr signal 7
|
||
|
for a table of signals and default actions.
|
||
|
.Pp
|
||
|
The
|
||
|
.Fn raise_default_signal
|
||
|
function should be async-signal-safe.
|
||
|
.Sh RETURN VALUES
|
||
|
Upon successful completion, a value of 0 is returned.
|
||
|
Otherwise, a value of \-1 is returned and the global variable
|
||
|
.Va errno
|
||
|
is set to indicate the error.
|
||
|
.Sh ERRORS
|
||
|
The
|
||
|
.Fn raise_default_signal
|
||
|
function may fail and set
|
||
|
.Va errno
|
||
|
for any of the errors specified for the functions
|
||
|
.Xr sigemptyset 3 ,
|
||
|
.Xr sigfillset 3 ,
|
||
|
.Xr sigaddset 3 ,
|
||
|
.Xr sigprocmask 2 ,
|
||
|
.Xr sigaction 2 ,
|
||
|
or
|
||
|
.Xr raise 3 .
|
||
|
.Sh SEE ALSO
|
||
|
.Xr sigaction 2 ,
|
||
|
.Xr sigprocmask 2 ,
|
||
|
.Xr raise 3 ,
|
||
|
.Xr signal 7
|
||
|
.Sh HISTORY
|
||
|
The
|
||
|
.Fn raise_default_signal
|
||
|
function first appeared in
|
||
|
.Nx 5.0 .
|