summaryrefslogtreecommitdiffstats
path: root/kernel/tests/lib/signame.h
blob: d420458bbb9cc50ab657e4e6ee77aa6d85840de2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
 * Copyright (c) 2014 Fujitsu Ltd.
 * Author: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it would be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

const char *tst_strsig(int sig)
{
	static const struct pair signal_pairs[] = {
		PAIR(SIGHUP)
		PAIR(SIGINT)
		PAIR(SIGQUIT)
		PAIR(SIGILL)
	#ifdef SIGTRAP
		PAIR(SIGTRAP)
	#endif

	#ifdef SIGIOT
		/* SIGIOT same as SIGABRT */
		STRPAIR(SIGABRT, "SIGIOT/SIGABRT")
	#else
		PAIR(SIGABRT)
	#endif

	#ifdef SIGEMT
		PAIR(SIGEMT)
	#endif
	#ifdef SIGBUS
		PAIR(SIGBUS)
	#endif
		PAIR(SIGFPE)
		PAIR(SIGKILL)
		PAIR(SIGUSR1)
		PAIR(SIGSEGV)
		PAIR(SIGUSR2)
		PAIR(SIGPIPE)
		PAIR(SIGALRM)
		PAIR(SIGTERM)
	#ifdef SIGSTKFLT
		PAIR(SIGSTKFLT)
	#endif
		PAIR(SIGCHLD)
		PAIR(SIGCONT)
		PAIR(SIGSTOP)
		PAIR(SIGTSTP)
		PAIR(SIGTTIN)
		PAIR(SIGTTOU)
	#ifdef SIGURG
		PAIR(SIGURG)
	#endif
	#ifdef SIGXCPU
		PAIR(SIGXCPU)
	#endif
	#ifdef SIGXFSZ
		PAIR(SIGXFSZ)
	#endif
	#ifdef SIGVTALRM
		PAIR(SIGVTALRM)
	#endif
	#ifdef SIGPROF
		PAIR(SIGPROF)
	#endif
	#ifdef SIGWINCH
		PAIR(SIGWINCH)
	#endif

	#if defined(SIGIO) && defined(SIGPOLL)
		/* SIGPOLL same as SIGIO */
		STRPAIR(SIGIO, "SIGIO/SIGPOLL")
	#elif defined(SIGIO)
		PAIR(SIGIO)
	#elif defined(SIGPOLL)
		PAIR(SIGPOLL)
	#endif

	#ifdef SIGINFO
		PAIR(SIGINFO)
	#endif
	#ifdef SIGLOST
		PAIR(SIGLOST)
	#endif
	#ifdef SIGPWR
		PAIR(SIGPWR)
	#endif
	#if defined(SIGSYS)
		/*
		 * According to signal(7)'s manpage, SIGUNUSED is synonymous
		 * with SIGSYS on most architectures.
		 */
		STRPAIR(SIGSYS, "SIGSYS/SIGUNUSED")
	#endif
	};

	PAIR_LOOKUP(signal_pairs, sig);
};