xref: /netbsd-src/lib/libc/gen/psignal.3 (revision 3991ffd1e1884319e0688c830d819a236df16e97)
1.\"	$NetBSD: psignal.3,v 1.17 2010/08/27 08:38:41 christos Exp $
2.\"
3.\" Copyright (c) 1983, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"     @(#)psignal.3	8.2 (Berkeley) 2/27/95
31.\"
32.Dd August 27, 2010
33.Dt PSIGNAL 3
34.Os
35.Sh NAME
36.Nm psignal ,
37.Nm psiginfo ,
38.Nm sys_siglist ,
39.Nm sys_signame
40.Nd system signal messages
41.Sh LIBRARY
42.Lb libc
43.Sh SYNOPSIS
44.In signal.h
45.Ft void
46.Fn psignal "int sig" "const char *s"
47.Fn psiginfo "const siginfo_t *si" "const char *s"
48.Vt extern const char * const sys_siglist[];
49.Vt extern const char * const sys_signame[];
50.Sh DESCRIPTION
51The
52.Fn psignal
53function locates the descriptive message
54string for the given signal number
55.Fa sig
56and writes it to the standard error.
57.Pp
58If the argument
59.Fa s
60is
61.Pf non- Dv NULL
62it is written to the standard error file descriptor
63prior to the message string,
64immediately followed by a colon and a space.
65If the signal number is not recognized
66.Pq Xr sigaction 2 ,
67the string
68.Dq "Unknown signal"
69is produced.
70.Pp
71The
72.Fn psiginfo
73function produces the same output as the
74.Fn psignal
75function, only it uses the signal number information from the
76.Fa si
77argument.
78.Pp
79The message strings can be accessed directly using the external array
80.Va sys_siglist ,
81indexed by recognized signal numbers.
82The external array
83.Va sys_signame
84is used similarly and contains short, upper-case abbreviations for signals
85which are useful for recognizing signal names in user input.
86The defined variable
87.Dv NSIG
88contains a count of the strings in
89.Va sys_siglist
90and
91.Va sys_signame .
92.Sh SEE ALSO
93.Xr sigaction 2 ,
94.Xr perror 3 ,
95.Xr setlocale 3 ,
96.Xr strsignal 3
97.Sh HISTORY
98The
99.Fn psignal
100function appeared in
101.Bx 4.2 .
102The
103.Fn psiginfo
104function appeared in
105.Nx 6.0 .
106