xref: /minix3/lib/libutil/raise_default_signal.3 (revision dba3562d7800d1fed3cb2cd859754872fbb2e84f)
1*dba3562dSLionel Sambuc.\"	$NetBSD: raise_default_signal.3,v 1.3 2011/03/27 12:53:16 njoly Exp $
20c3983b2SBen Gras.\"
30c3983b2SBen Gras.\" Copyright (c) 2007 The NetBSD Foundation, Inc.
40c3983b2SBen Gras.\" All rights reserved.
50c3983b2SBen Gras.\"
60c3983b2SBen Gras.\" This code is derived from software contributed to The NetBSD Foundation
70c3983b2SBen Gras.\" by Luke Mewburn.
80c3983b2SBen Gras.\"
90c3983b2SBen Gras.\" Redistribution and use in source and binary forms, with or without
100c3983b2SBen Gras.\" modification, are permitted provided that the following conditions
110c3983b2SBen Gras.\" are met:
120c3983b2SBen Gras.\" 1. Redistributions of source code must retain the above copyright
130c3983b2SBen Gras.\"    notice, this list of conditions and the following disclaimer.
140c3983b2SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright
150c3983b2SBen Gras.\"    notice, this list of conditions and the following disclaimer in the
160c3983b2SBen Gras.\"    documentation and/or other materials provided with the distribution.
170c3983b2SBen Gras.\"
180c3983b2SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
190c3983b2SBen Gras.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
200c3983b2SBen Gras.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
210c3983b2SBen Gras.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
220c3983b2SBen Gras.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
230c3983b2SBen Gras.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
240c3983b2SBen Gras.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
250c3983b2SBen Gras.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
260c3983b2SBen Gras.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
270c3983b2SBen Gras.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
280c3983b2SBen Gras.\" POSSIBILITY OF SUCH DAMAGE.
290c3983b2SBen Gras.\"
300c3983b2SBen Gras.Dd September 25, 2007
310c3983b2SBen Gras.Dt RAISE_DEFAULT_SIGNAL 3
320c3983b2SBen Gras.Os
330c3983b2SBen Gras.Sh NAME
340c3983b2SBen Gras.Nm raise_default_signal
350c3983b2SBen Gras.Nd raise the default signal handler
360c3983b2SBen Gras.Sh LIBRARY
370c3983b2SBen Gras.Lb libutil
380c3983b2SBen Gras.Sh SYNOPSIS
390c3983b2SBen Gras.In util.h
400c3983b2SBen Gras.Ft int
410c3983b2SBen Gras.Fo raise_default_signal
420c3983b2SBen Gras.Fa "int sig"
430c3983b2SBen Gras.Fc
440c3983b2SBen Gras.Sh DESCRIPTION
450c3983b2SBen GrasThe
460c3983b2SBen Gras.Fn raise_default_signal
470c3983b2SBen Grasfunction raises the default signal handler for the signal
480c3983b2SBen Gras.Fa sig .
490c3983b2SBen GrasThis function may be used by a user-defined signal handler router
500c3983b2SBen Grasto ensure that a parent process receives the correct notification
510c3983b2SBen Grasof a process termination by a signal.
520c3983b2SBen GrasThis can be used to avoid a common programming mistake
530c3983b2SBen Graswhen terminating a process from a custom
540c3983b2SBen Gras.Dv SIGINT
550c3983b2SBen Grasor
560c3983b2SBen Gras.Dv SIGQUIT
570c3983b2SBen Grassignal handler.
580c3983b2SBen Gras.Pp
590c3983b2SBen GrasThe operations performed are:
600c3983b2SBen Gras.Bl -enum -offset indent
610c3983b2SBen Gras.It
620c3983b2SBen GrasBlock all signals, using
63*dba3562dSLionel Sambuc.Xr sigprocmask 2 .
640c3983b2SBen Gras.It
650c3983b2SBen GrasSet the signal handler for signal
660c3983b2SBen Gras.Fa sig
670c3983b2SBen Grasto the default signal handler
680c3983b2SBen Gras.Dv ( SIG_DFL ) .
690c3983b2SBen Gras.It
700c3983b2SBen Gras.Xr raise 3
710c3983b2SBen Grassignal
720c3983b2SBen Gras.Fa sig .
730c3983b2SBen Gras.It
740c3983b2SBen GrasUnblock signal
750c3983b2SBen Gras.Fa sig
760c3983b2SBen Grasto deliver it.
770c3983b2SBen Gras.It
780c3983b2SBen GrasRestore the original signal mask and handler,
790c3983b2SBen Graseven if there was a failure.
800c3983b2SBen Gras.El
810c3983b2SBen Gras.Pp
820c3983b2SBen GrasSee
830c3983b2SBen Gras.Xr signal 7
840c3983b2SBen Grasfor a table of signals and default actions.
850c3983b2SBen Gras.Pp
860c3983b2SBen GrasThe
870c3983b2SBen Gras.Fn raise_default_signal
880c3983b2SBen Grasfunction should be async-signal-safe.
890c3983b2SBen Gras.Sh RETURN VALUES
900c3983b2SBen GrasUpon successful completion, a value of 0 is returned.
910c3983b2SBen GrasOtherwise, a value of \-1 is returned and the global variable
920c3983b2SBen Gras.Va errno
930c3983b2SBen Grasis set to indicate the error.
940c3983b2SBen Gras.Sh ERRORS
950c3983b2SBen GrasThe
960c3983b2SBen Gras.Fn raise_default_signal
970c3983b2SBen Grasfunction may fail and set
980c3983b2SBen Gras.Va errno
990c3983b2SBen Grasfor any of the errors specified for the functions
1000c3983b2SBen Gras.Xr sigemptyset 3 ,
1010c3983b2SBen Gras.Xr sigfillset 3 ,
1020c3983b2SBen Gras.Xr sigaddset 3 ,
1030c3983b2SBen Gras.Xr sigprocmask 2 ,
1040c3983b2SBen Gras.Xr sigaction 2 ,
1050c3983b2SBen Grasor
1060c3983b2SBen Gras.Xr raise 3 .
1070c3983b2SBen Gras.Sh SEE ALSO
1080c3983b2SBen Gras.Xr sigaction 2 ,
1090c3983b2SBen Gras.Xr sigprocmask 2 ,
1100c3983b2SBen Gras.Xr raise 3 ,
1110c3983b2SBen Gras.Xr signal 7
1120c3983b2SBen Gras.Sh HISTORY
1130c3983b2SBen GrasThe
1140c3983b2SBen Gras.Fn raise_default_signal
1150c3983b2SBen Grasfunction first appeared in
1160c3983b2SBen Gras.Nx 5.0 .
117