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
|
/* ISC license. */
#include <stdlib.h>
#include <skalibs/bytestr.h>
#include <skalibs/sig.h>
struct sigtable_s
{
char const *name ;
int number ;
} ;
static struct sigtable_s const table[] =
{
{ "ABRT", SIGABRT },
{ "ALRM", SIGALRM },
{ "BUS", SIGBUS },
{ "CHLD", SIGCHLD },
#ifdef SIGCLD
{ "CLD", SIGCLD },
#endif
{ "CONT", SIGCONT },
#ifdef SIGEMT
{ "EMT", SIGEMT },
#endif
{ "FPE", SIGFPE },
{ "HUP", SIGHUP },
{ "ILL", SIGILL },
#ifdef SIGINFO
{ "INFO", SIGINFO },
#endif
{ "INT", SIGINT },
#ifdef SIGIO
{ "IO", SIGIO },
#endif
#ifdef SIGIOT
{ "IOT", SIGIOT },
#endif
{ "KILL", SIGKILL },
#ifdef SIGLOST
{ "LOST", SIGLOST },
#endif
{ "PIPE", SIGPIPE },
#ifdef SIGPOLL
{ "POLL", SIGPOLL },
#endif
#ifdef SIGPROF
{ "PROF", SIGPROF },
#endif
#ifdef SIGPWR
{ "PWR", SIGPWR },
#endif
{ "QUIT", SIGQUIT },
{ "SEGV", SIGSEGV },
#ifdef SIGSTKFLT
{ "STKFLT", SIGSTKFLT },
#endif
{ "STOP", SIGSTOP },
#ifdef SIGSYS
{ "SYS", SIGSYS },
#endif
{ "TERM", SIGTERM },
#ifdef SIGTRAP
{ "TRAP", SIGTRAP },
#endif
{ "TSTP", SIGTSTP },
{ "TTIN", SIGTTIN },
{ "TTOU", SIGTTOU },
#ifdef SIGUNUSED
{ "UNUSED", SIGUNUSED },
#endif
#ifdef SIGURG
{ "URG", SIGURG },
#endif
{ "USR1", SIGUSR1 },
{ "USR2", SIGUSR2 },
#ifdef SIGVTALRM
{ "VTALRM", SIGVTALRM },
#endif
#ifdef SIGWINCH
{ "WINCH", SIGWINCH },
#endif
#ifdef SIGXCPU
{ "XCPU", SIGXCPU },
#endif
#ifdef SIGXFSZ
{ "XFSZ", SIGXFSZ },
#endif
} ;
int sig_number (char const *name)
{
struct sigtable_s *p = bsearch(name, table, sizeof(table)/sizeof(struct sigtable_s), sizeof(struct sigtable_s), &stringkey_bcasecmp) ;
return p ? p->number : 0 ;
}
|