]> git.ipfire.org Git - thirdparty/util-linux.git/blob - include/signames.h
signames: Make input char buffers const
[thirdparty/util-linux.git] / include / signames.h
1 #ifndef SIGNAMES_H
2 #define SIGNAMES_H
3
4 /*
5 * Copyright (c) 1988, 1993, 1994, 2017
6 * The Regents of the University of California. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36 /*
37 * 2017-10-14 Niklas Hambüchen <mail@nh2.me>
38 * - Extracted signal names mapping from kill.c
39 *
40 * Copyright (C) 2014 Sami Kerola <kerolasa@iki.fi>
41 * Copyright (C) 2014 Karel Zak <kzak@redhat.com>
42 * Copyright (C) 2017 Niklas Hambüchen <mail@nh2.me>
43 */
44
45 #include <signal.h>
46
47 static const struct signv {
48 const char *name;
49 int val;
50 } sys_signame[] = {
51 /* POSIX signals */
52 { "HUP", SIGHUP }, /* 1 */
53 { "INT", SIGINT }, /* 2 */
54 { "QUIT", SIGQUIT }, /* 3 */
55 { "ILL", SIGILL }, /* 4 */
56 #ifdef SIGTRAP
57 { "TRAP", SIGTRAP }, /* 5 */
58 #endif
59 { "ABRT", SIGABRT }, /* 6 */
60 #ifdef SIGIOT
61 { "IOT", SIGIOT }, /* 6, same as SIGABRT */
62 #endif
63 #ifdef SIGEMT
64 { "EMT", SIGEMT }, /* 7 (mips,alpha,sparc*) */
65 #endif
66 #ifdef SIGBUS
67 { "BUS", SIGBUS }, /* 7 (arm,i386,m68k,ppc), 10 (mips,alpha,sparc*) */
68 #endif
69 { "FPE", SIGFPE }, /* 8 */
70 { "KILL", SIGKILL }, /* 9 */
71 { "USR1", SIGUSR1 }, /* 10 (arm,i386,m68k,ppc), 30 (alpha,sparc*), 16 (mips) */
72 { "SEGV", SIGSEGV }, /* 11 */
73 { "USR2", SIGUSR2 }, /* 12 (arm,i386,m68k,ppc), 31 (alpha,sparc*), 17 (mips) */
74 { "PIPE", SIGPIPE }, /* 13 */
75 { "ALRM", SIGALRM }, /* 14 */
76 { "TERM", SIGTERM }, /* 15 */
77 #ifdef SIGSTKFLT
78 { "STKFLT", SIGSTKFLT }, /* 16 (arm,i386,m68k,ppc) */
79 #endif
80 { "CHLD", SIGCHLD }, /* 17 (arm,i386,m68k,ppc), 20 (alpha,sparc*), 18 (mips) */
81 #ifdef SIGCLD
82 { "CLD", SIGCLD }, /* same as SIGCHLD (mips) */
83 #endif
84 { "CONT", SIGCONT }, /* 18 (arm,i386,m68k,ppc), 19 (alpha,sparc*), 25 (mips) */
85 { "STOP", SIGSTOP }, /* 19 (arm,i386,m68k,ppc), 17 (alpha,sparc*), 23 (mips) */
86 { "TSTP", SIGTSTP }, /* 20 (arm,i386,m68k,ppc), 18 (alpha,sparc*), 24 (mips) */
87 { "TTIN", SIGTTIN }, /* 21 (arm,i386,m68k,ppc,alpha,sparc*), 26 (mips) */
88 { "TTOU", SIGTTOU }, /* 22 (arm,i386,m68k,ppc,alpha,sparc*), 27 (mips) */
89 #ifdef SIGURG
90 { "URG", SIGURG }, /* 23 (arm,i386,m68k,ppc), 16 (alpha,sparc*), 21 (mips) */
91 #endif
92 #ifdef SIGXCPU
93 { "XCPU", SIGXCPU }, /* 24 (arm,i386,m68k,ppc,alpha,sparc*), 30 (mips) */
94 #endif
95 #ifdef SIGXFSZ
96 { "XFSZ", SIGXFSZ }, /* 25 (arm,i386,m68k,ppc,alpha,sparc*), 31 (mips) */
97 #endif
98 #ifdef SIGVTALRM
99 { "VTALRM", SIGVTALRM }, /* 26 (arm,i386,m68k,ppc,alpha,sparc*), 28 (mips) */
100 #endif
101 #ifdef SIGPROF
102 { "PROF", SIGPROF }, /* 27 (arm,i386,m68k,ppc,alpha,sparc*), 29 (mips) */
103 #endif
104 #ifdef SIGWINCH
105 { "WINCH", SIGWINCH }, /* 28 (arm,i386,m68k,ppc,alpha,sparc*), 20 (mips) */
106 #endif
107 #ifdef SIGIO
108 { "IO", SIGIO }, /* 29 (arm,i386,m68k,ppc), 23 (alpha,sparc*), 22 (mips) */
109 #endif
110 #ifdef SIGPOLL
111 { "POLL", SIGPOLL }, /* same as SIGIO */
112 #endif
113 #ifdef SIGINFO
114 { "INFO", SIGINFO }, /* 29 (alpha) */
115 #endif
116 #ifdef SIGLOST
117 { "LOST", SIGLOST }, /* 29 (arm,i386,m68k,ppc,sparc*) */
118 #endif
119 #ifdef SIGPWR
120 { "PWR", SIGPWR }, /* 30 (arm,i386,m68k,ppc), 29 (alpha,sparc*), 19 (mips) */
121 #endif
122 #ifdef SIGUNUSED
123 { "UNUSED", SIGUNUSED }, /* 31 (arm,i386,m68k,ppc) */
124 #endif
125 #ifdef SIGSYS
126 { "SYS", SIGSYS }, /* 31 (mips,alpha,sparc*) */
127 #endif
128 };
129
130 int signame_to_signum(const char *sig);
131
132 #endif /* SIGNAMES_H */