aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstddjb/sig_name.c
blob: 36b6ac09ceba18ec91d2501a8ef92a302ea1da34 (plain)
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
 /* ISC license. */

#include <skalibs/nonposix.h>

#include <signal.h>
#include <skalibs/nsig.h>

static char const *const table[SKALIBS_NSIG] =
{
  [SIGABRT] = "ABRT",
  [SIGALRM] = "ALRM",
  [SIGBUS] = "BUS",
  [SIGCHLD] = "CHLD",
  [SIGCONT] = "CONT",
  [SIGFPE] = "FPE",
  [SIGHUP] = "HUP",
  [SIGILL] = "ILL",
  [SIGINT] = "INT",
  [SIGKILL] = "KILL",
  [SIGPIPE] = "PIPE",
  [SIGQUIT] = "QUIT",
  [SIGSEGV] = "SEGV",
  [SIGSTOP] = "STOP",
  [SIGTERM] = "TERM",
  [SIGTSTP] = "TSTP",
  [SIGTTIN] = "TTIN",
  [SIGTTOU] = "TTOU",
  [SIGUSR1] = "USR1",
  [SIGUSR2] = "USR2",
#ifdef SIGPOLL
  [SIGPOLL] = "POLL",
#endif
#ifdef SIGPROF
  [SIGPROF] = "PROF",
#endif 
#ifdef SIGSYS
  [SIGSYS] = "SYS",
#endif
#ifdef SIGTRAP
  [SIGTRAP] = "TRAP",
#endif
#ifdef SIGURG
  [SIGURG] = "URG",
#endif
#ifdef SIGVTALRM
  [SIGVTALRM] = "VTALRM",
#endif
#ifdef SIGXCPU
  [SIGXCPU] = "XCPU",
#endif
#ifdef SIGXFSZ
  [SIGXFSZ] = "XFSZ",
#endif
#ifdef SIGIOT
  [SIGIOT] = "IOT",
#endif
#ifdef SIGEMT
  [SIGEMT] = "EMT",
#endif
#ifdef SIGSTKFLT
  [SIGSTKFLT] = "STKFLT",
#endif
#ifdef SIGCLD
  [SIGCLD] = "CLD",
#endif
#ifdef SIGWINCH
  [SIGWINCH] = "WINCH",
#endif
#ifdef SIGIO
  [SIGIO] = "IO",
#endif
#ifdef SIGINFO
  [SIGINFO] = "INFO",
#endif
#ifdef SIGLOST
  [SIGLOST] = "LOST",
#endif
#ifdef SIGPWR
  [SIGPWR] = "PWR",
#endif
#ifdef SIGUNUSED
  [SIGUNUSED] = "UNUSED"   
#endif
} ;

char const *sig_name (int sig)
{
  return sig <= 0 || sig > SKALIBS_NSIG || !table[sig] ? "???" : table[sig] ;
}