xref: /netbsd-src/lib/libc/gen/psignal.3 (revision 4b30c543a0b21e3ba94f2c569e9a82b4fdb2075f)
1.\" Copyright (c) 1983, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     from: @(#)psignal.3	6.2 (Berkeley) 4/19/91
33.\"	$Id: psignal.3,v 1.4 1993/09/08 18:43:20 jtc Exp $
34.\"
35.Dd April 19, 1991
36.Dt PSIGNAL 3
37.Os BSD 4.2
38.Sh NAME
39.Nm psignal ,
40.Nm sys_siglist ,
41.Nm sys_signame
42.Nd system signal messages
43.Sh SYNOPSIS
44.Fd #include <sys/signal.h>
45.Ft void
46.Fn psignal "unsigned sig" "const char *s"
47.Vt extern char *sys_siglist[];
48.Vt extern char *sys_signame[];
49.Sh DESCRIPTION
50The
51.Fn psignal
52function locates the descriptive message
53string for the given signal
54.Fa sig
55number
56and writes it to the
57.Em stderr .
58.Pp
59If the argument
60.Fa s
61is
62.Pf non- Dv NULL
63it is written to the
64.Em stderr
65prior to the message string.
66The signal number should be from among those found in
67.Aq Pa signal.h .
68.Pp
69The message strings can be accessed directly using the external array
70.Va sys_siglist ,
71indexed by recognized signal numbers.  The external array
72.Va sys_signame
73is used similarly and contains short, upper-case abbreviations for signals
74which are useful for recognizing signal names in user input.  The defined
75variable
76.Dv NSIG
77contains a count of the strings in
78.Va sys_siglist
79and
80.Va sys_signame .
81.Sh SEE ALSO
82.Xr sigaction 2 ,
83.Xr perror 3
84.Sh HISTORY
85The
86.Fn psignal
87function appeared in
88.Bx 4.2 .
89