1 /*
2 * Copyright (c) 2014 Fujitsu Ltd.
3 * Author: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
tst_strsig(int sig)18 const char *tst_strsig(int sig)
19 {
20 static const struct pair signal_pairs[] = {
21 PAIR(SIGHUP)
22 PAIR(SIGINT)
23 PAIR(SIGQUIT)
24 PAIR(SIGILL)
25 #ifdef SIGTRAP
26 PAIR(SIGTRAP)
27 #endif
28
29 #ifdef SIGIOT
30 /* SIGIOT same as SIGABRT */
31 STRPAIR(SIGABRT, "SIGIOT/SIGABRT")
32 #else
33 PAIR(SIGABRT)
34 #endif
35
36 #ifdef SIGEMT
37 PAIR(SIGEMT)
38 #endif
39 #ifdef SIGBUS
40 PAIR(SIGBUS)
41 #endif
42 PAIR(SIGFPE)
43 PAIR(SIGKILL)
44 PAIR(SIGUSR1)
45 PAIR(SIGSEGV)
46 PAIR(SIGUSR2)
47 PAIR(SIGPIPE)
48 PAIR(SIGALRM)
49 PAIR(SIGTERM)
50 #ifdef SIGSTKFLT
51 PAIR(SIGSTKFLT)
52 #endif
53 PAIR(SIGCHLD)
54 PAIR(SIGCONT)
55 PAIR(SIGSTOP)
56 PAIR(SIGTSTP)
57 PAIR(SIGTTIN)
58 PAIR(SIGTTOU)
59 #ifdef SIGURG
60 PAIR(SIGURG)
61 #endif
62 #ifdef SIGXCPU
63 PAIR(SIGXCPU)
64 #endif
65 #ifdef SIGXFSZ
66 PAIR(SIGXFSZ)
67 #endif
68 #ifdef SIGVTALRM
69 PAIR(SIGVTALRM)
70 #endif
71 #ifdef SIGPROF
72 PAIR(SIGPROF)
73 #endif
74 #ifdef SIGWINCH
75 PAIR(SIGWINCH)
76 #endif
77
78 #if defined(SIGIO) && defined(SIGPOLL)
79 /* SIGPOLL same as SIGIO */
80 STRPAIR(SIGIO, "SIGIO/SIGPOLL")
81 #elif defined(SIGIO)
82 PAIR(SIGIO)
83 #elif defined(SIGPOLL)
84 PAIR(SIGPOLL)
85 #endif
86
87 #ifdef SIGINFO
88 PAIR(SIGINFO)
89 #endif
90 #ifdef SIGLOST
91 PAIR(SIGLOST)
92 #endif
93 #ifdef SIGPWR
94 PAIR(SIGPWR)
95 #endif
96 #if defined(SIGSYS)
97 /*
98 * According to signal(7)'s manpage, SIGUNUSED is synonymous
99 * with SIGSYS on most architectures.
100 */
101 STRPAIR(SIGSYS, "SIGSYS/SIGUNUSED")
102 #endif
103 };
104
105 PAIR_LOOKUP(signal_pairs, sig);
106 };
107