strsignal.c\string\src - musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/string/strsignal.c
blob: 72fba8d1218b351bcf100ee832e509d564d6d067 (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
#include <signal.h>
#if (SIGHUP == 1) && (SIGINT == 2) && (SIGQUIT == 3) && (SIGILL == 4) \
 && (SIGTRAP == 5) && (SIGABRT == 6) && (SIGBUS == 7) && (SIGFPE == 8) \
 && (SIGKILL == 9) && (SIGUSR1 == 10) && (SIGSEGV == 11) && (SIGUSR2 == 12) \
 && (SIGPIPE == 13) && (SIGALRM == 14) && (SIGTERM == 15) && (SIGSTKFLT == 16) \
 && (SIGCHLD == 17) && (SIGCONT == 18) && (SIGSTOP == 19) && (SIGTSTP == 20) \
 && (SIGTTIN == 21) && (SIGTTOU == 22) && (SIGURG == 23) && (SIGXCPU == 24) \
 && (SIGXFSZ == 25) && (SIGVTALRM == 26) && (SIGPROF == 27) && (SIGWINCH == 28) \
 && (SIGPOLL == 29) && (SIGPWR == 30) && (SIGSYS == 31)
#define sigmap(x) x
#else
static const char map[] = {
	[SIGHUP] = 1,
	[SIGINT] = 2,
	[SIGQUIT] = 3,
	[SIGILL] = 4,
	[SIGTRAP] = 5,
	[SIGABRT] = 6,
	[SIGBUS] = 7,
	[SIGFPE] = 8,
	[SIGKILL] = 9,
	[SIGUSR1] = 10,
	[SIGSEGV] = 11,
	[SIGUSR2] = 12,
	[SIGPIPE] = 13,
	[SIGALRM] = 14,
	[SIGTERM] = 15,
	[SIGSTKFLT] = 16,
	[SIGCHLD] = 17,
	[SIGCONT] = 18,
	[SIGSTOP] = 19,
	[SIGTSTP] = 20,
	[SIGTTIN] = 21,
	[SIGTTOU] = 22,
	[SIGURG] = 23,
	[SIGXCPU] = 24,
	[SIGXFSZ] = 25,
	[SIGVTALRM] = 26,
	[SIGPROF] = 27,
	[SIGWINCH] = 28,
	[SIGPOLL] = 29,
	[SIGPWR] = 30,
	[SIGSYS] = 31
};
#define sigmap(x) ((unsigned)(x) > sizeof map ? 0 : map[(unsigned)(x)])
#endif
static const char strings[] =
	"Unknown signal0円"
	"Hangup0円"
	"Interrupt0円"
	"Quit0円"
	"Illegal instruction0円"
	"Trace/breakpoint trap0円"
	"Aborted0円"
	"Bus error0円"
	"Floating point exception0円"
	"Killed0円"
	"User defined signal 10円"
	"Segmentation fault0円"
	"User defined signal 20円"
	"Broken pipe0円"
	"Alarm clock0円"
	"Terminated0円"
	"Stack fault0円"
	"Child exited0円"
	"Continued0円"
	"Stopped (signal)0円"
	"Stopped0円"
	"Stopped (tty input)0円"
	"Stopped (tty output)0円"
	"Urgent I/O condition0円"
	"CPU time limit exceeded0円"
	"File size limit exceeded0円"
	"Virtual timer expired0円"
	"Profiling timer expired0円"
	"Window changed0円"
	"I/O possible0円"
	"Power failure0円"
	"Bad system call";
char *strsignal(int signum)
{
	char *s = (char *)strings;
	signum = sigmap(signum);
	if ((unsigned)signum - 1 > 31) signum = 0;
	for (; signum--; s++) for (; *s; s++);
	return s;
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月25日 18:28:34 +0000

AltStyle によって変換されたページ (->オリジナル) /