xref: /illumos-gate/usr/src/contrib/ast/src/cmd/ksh93/data/signals.c (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1982-2012 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                 Eclipse Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *          http://www.eclipse.org/org/documents/epl-v10.html           *
11 *         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                  David Korn <dgk@research.att.com>                   *
18 *                                                                      *
19 ***********************************************************************/
20 #include	"defs.h"
21 
22 #if defined(SIGCLD) && !defined(SIGCHLD)
23 #   define SIGCHLD	SIGCLD
24 #endif
25 
26 #define VAL(sig,mode)	((sig+1)|((mode)<<SH_SIGBITS))
27 #define TRAP(n)		(((n)|SH_TRAP)-1)
28 
29 #ifndef ERROR_dictionary
30 #   define  ERROR_dictionary(s)	(s)
31 #endif
32 #define S(s)		ERROR_dictionary(s)
33 
34 /*
35  * This is a table that gives numbers and default settings to each signal.
36  * The signal numbers go in the low bits and the attributes go in the high bits.
37  * The names must be ASCII sorted lo-hi.
38  */
39 
40 const struct shtable2 shtab_signals[] =
41 {
42 #ifdef SIGABRT
43 	"ABRT",		VAL(SIGABRT,SH_SIGDONE), 			S("Abort"),
44 #endif /*SIGABRT */
45 #ifdef SIGAIO
46 	"AIO",		VAL(SIGAIO,SH_SIGIGNORE), 			S("Asynchronous I/O"),
47 #endif /*SIGAIO */
48 #ifdef SIGALRM
49 	"ALRM",		VAL(SIGALRM,SH_SIGDONE),			S("Alarm call"),
50 #endif /* SIGALRM */
51 #ifdef SIGALRM1
52 	"ALRM1",	VAL(SIGALRM1,SH_SIGDONE),			S("Scheduling - reserved"),
53 #endif /* SIGALRM */
54 #ifdef SIGAPOLLO
55 	"APOLLO",	VAL(SIGAPOLLO,0),				S("SIGAPOLLO"),
56 #endif /* SIGAPOLLO */
57 #ifdef SIGBUS
58 	"BUS",		VAL(SIGBUS,SH_SIGDONE),				S("Bus error"),
59 #endif /* SIGBUS */
60 #ifdef SIGCANCEL
61 	"CANCEL",	VAL(SIGCANCEL,SH_SIGIGNORE), 			S("Thread cancellation"),
62 #endif /*SIGCANCEL */
63 #ifdef SIGCHLD
64 	"CHLD",		VAL(SIGCHLD,SH_SIGFAULT), 			S("Death of Child"),
65 #   ifdef SIGCLD
66 #	if SIGCLD!=SIGCHLD
67 	    "CLD",	VAL(SIGCLD,SH_SIGFAULT),			S("Death of Child"),
68 #	endif
69 #   endif	/* SIGCLD */
70 #else
71 #   ifdef SIGCLD
72 	"CLD",		VAL(SIGCLD,SH_SIGFAULT),			S("Death of Child"),
73 #   endif	/* SIGCLD */
74 #endif	/* SIGCHLD */
75 #ifdef SIGCONT
76 	"CONT",		VAL(SIGCONT,SH_SIGIGNORE),			S("Stopped process continued"),
77 #endif	/* SIGCONT */
78 #ifdef SIGCPUFAIL
79 	"CPUFAIL",	VAL(SIGCPUFAIL,0),				S("Predictive processor deconfiguration"),
80 #endif	/* SIGRETRACT */
81 	"DEBUG",	VAL(TRAP(SH_DEBUGTRAP),0),			"",
82 #ifdef SIGDANGER
83 	"DANGER",	VAL(SIGDANGER,0),				S("System crash soon"),
84 #endif	/* SIGDANGER */
85 #ifdef SIGDIL
86 	"DIL",		VAL(SIGDIL,0),					S("DIL signal"),
87 #endif	/* SIGDIL */
88 #ifdef SIGEMT
89 	"EMT",		VAL(SIGEMT,SH_SIGDONE),				S("EMT trap"),
90 #endif	/* SIGEMT */
91 	"ERR",		VAL(TRAP(SH_ERRTRAP),0),			"",
92 #ifdef SIGERR
93 	"ERR",		VAL(SIGERR,0),					"",
94 #endif /* SIGERR */
95 	"EXIT",		VAL(0,0),					"",
96 	"FPE",		VAL(SIGFPE,SH_SIGDONE),				S("Floating exception"),
97 #ifdef SIGFREEZE
98 	"FREEZE",	VAL(SIGFREEZE,SH_SIGIGNORE),			S("Special signal used by CPR"),
99 #endif	/* SIGFREEZE */
100 #ifdef SIGGRANT
101 	"GRANT",	VAL(SIGGRANT,0),				S("Grant monitor mode"),
102 #endif /* SIGGRANT */
103 	"HUP",		VAL(SIGHUP,SH_SIGDONE),				S("Hangup"),
104 	"ILL",		VAL(SIGILL,SH_SIGDONE),				S("Illegal instruction"),
105 #ifdef SIGINFO
106 	"INFO",         VAL(SIGINFO,SH_SIGIGNORE),                      S("Information request"),
107 #endif /*SIGINFO */
108 #ifdef JOBS
109 	"INT",		VAL(SIGINT,SH_SIGINTERACTIVE),			S("Interrupt"),
110 #else
111 	"INT",		VAL(SIGINT,SH_SIGINTERACTIVE),			"",
112 #endif /* JOBS */
113 #ifdef SIGIO
114 	"IO",		VAL(SIGIO,SH_SIGDONE),				S("IO signal"),
115 #endif	/* SIGIO */
116 #ifdef SIGIOT
117 	"IOT",		VAL(SIGIOT,SH_SIGDONE),				S("Abort"),
118 #endif	/* SIGIOT */
119 #ifdef SIGJVM1
120 	"JVM1",		VAL(SIGJVM1,SH_SIGIGNORE), 			S("Special signal used by Java Virtual Machine"),
121 #endif /*SIGJVM1 */
122 #ifdef SIGJVM2
123 	"JVM2",		VAL(SIGJVM2,SH_SIGIGNORE), 			S("Special signal used by Java Virtual Machine"),
124 #endif /*SIGJVM2 */
125 	"KEYBD",	VAL(TRAP(SH_KEYTRAP),0),			"",
126 #ifdef SIGKILL
127 	"KILL",		VAL(SIGKILL,0),					S("Killed"),
128 #endif /* SIGKILL */
129 #ifdef SIGLAB
130 	"LAB",		VAL(SIGLAB,0),					S("Security label changed"),
131 #endif	/* SIGLAB */
132 #ifdef SIGLOST
133 	"LOST",		VAL(SIGLOST,SH_SIGDONE),			S("Resources lost"),
134 #endif	/* SIGLOST */
135 #ifdef SIGLWP
136 	"LWP",		VAL(SIGLWP,SH_SIGIGNORE),			S("Special signal used by thread library"),
137 #endif	/* SIGLWP */
138 #ifdef SIGMIGRATE
139 	"MIGRATE",	VAL(SIGMIGRATE,0),				S("Migrate process"),
140 #endif	/* SIGMIGRATE */
141 #ifdef SIGMSG
142 	"MSG",		VAL(SIGMSG,0),					S("Ring buffer input data"),
143 #endif	/* SIGMSG */
144 #ifdef SIGPHONE
145 	"PHONE",	VAL(SIGPHONE,0),				S("Phone interrupt"),
146 #endif	/* SIGPHONE */
147 #ifdef SIGPIPE
148 #ifdef JOBS
149 	"PIPE",		VAL(SIGPIPE,SH_SIGDONE),			S("Broken Pipe"),
150 #else
151 	"PIPE",		VAL(SIGPIPE,SH_SIGDONE),	 		"",
152 #endif /* JOBS */
153 #endif /* SIGPIPE */
154 #ifdef SIGPOLL
155 	"POLL",		VAL(SIGPOLL,SH_SIGDONE),			S("Polling alarm"),
156 #endif	/* SIGPOLL */
157 #ifdef SIGPROF
158 	"PROF",		VAL(SIGPROF,SH_SIGDONE), 			S("Profiling time alarm"),
159 #endif	/* SIGPROF */
160 #ifdef SIGPRE
161 	"PRE",		VAL(SIGPRE,SH_SIGDONE), 			S("Programming exception"),
162 #endif	/* SIGPRE */
163 #ifdef SIGPWR
164 #   if SIGPWR>0
165 	"PWR",		VAL(SIGPWR,SH_SIGIGNORE),			S("Power fail"),
166 #   endif
167 #endif	/* SIGPWR */
168 #ifdef SIGQUIT
169 	"QUIT",		VAL(SIGQUIT,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Quit"),
170 #endif	/* SIGQUIT */
171 #ifdef SIGRETRACT
172 	"RETRACT",	VAL(SIGRETRACT,0),				S("Relinquish monitor mode"),
173 #endif	/* SIGRETRACT */
174 #ifdef SIGRTMIN
175 	"RTMIN",	VAL(SH_SIGRTMIN,SH_SIGRUNTIME),			S("Lowest priority realtime signal"),
176 #endif	/* SIGRTMIN */
177 #ifdef SIGRTMAX
178 	"RTMAX",	VAL(SH_SIGRTMAX,SH_SIGRUNTIME),			S("Highest priority realtime signal"),
179 #endif	/* SIGRTMAX */
180 #ifdef SIGSAK
181 	"SAK",		VAL(SIGSAK,0),					S("Secure attention key"),
182 #endif	/* SIGSAK */
183 	"SEGV",		VAL(SIGSEGV,0),					S("Memory fault"),
184 #ifdef SIGSOUND
185 	"SOUND",	VAL(SIGSOUND,0),				S("Sound completed"),
186 #endif	/* SIGSOUND */
187 #ifdef SIGSTOP
188 	"STOP",		VAL(SIGSTOP,0),					S("Stopped (SIGSTOP)"),
189 #endif	/* SIGSTOP */
190 #ifdef SIGSYS
191 	"SYS",		VAL(SIGSYS,SH_SIGDONE),				S("Bad system call"),
192 #endif	/* SIGSYS */
193 #ifdef SIGSTKFLT
194 	"STKFLT",	VAL(SIGSTKFLT,SH_SIGDONE),			S("Stack Fault"),
195 #endif /* SIGSTKFLT */
196 	"TERM",		VAL(SIGTERM,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Terminated"),
197 #ifdef SIGTHAW
198 	"THAW",		VAL(SIGTHAW,SH_SIGIGNORE),			S("Special signal used by CPR"),
199 #endif	/* SIGTHAW */
200 #ifdef SIGTINT
201 #   ifdef JOBS
202 	"TINT",		VAL(SIGTINT,0),					S("Interrupt"),
203 #   else
204 	"TINT",		VAL(SIGTINT,0),					"",
205 #   endif /* JOBS */
206 #endif	/* SIGTINT */
207 #ifdef SIGTRAP
208 	"TRAP",		VAL(SIGTRAP,SH_SIGDONE),			S("Trace/BPT trap"),
209 #endif	/* SIGTRAP */
210 #ifdef SIGTSTP
211 	"TSTP",		VAL(SIGTSTP,0),					S("Stopped"),
212 #endif	/* SIGTSTP */
213 #ifdef SIGTTIN
214 	"TTIN",		VAL(SIGTTIN,0),					S("Stopped (SIGTTIN)"),
215 #endif	/* SIGTTIN */
216 #ifdef SIGTTOU
217 	"TTOU",		VAL(SIGTTOU,0),					S("Stopped (SIGTTOU)"),
218 #endif	/* SIGTTOU */
219 #ifdef SIGURG
220 	"URG",		VAL(SIGURG,SH_SIGIGNORE),			S("Socket interrupt"),
221 #endif	/* SIGURG */
222 #ifdef SIGUSR1
223 	"USR1",		VAL(SIGUSR1,SH_SIGDONE),			S("User signal 1"),
224 #endif	/* SIGUSR1 */
225 #ifdef SIGUSR2
226 	"USR2",		VAL(SIGUSR2,SH_SIGDONE),	 		S("User signal 2"),
227 #endif	/* SIGUSR2 */
228 #ifdef SIGVIRT
229 	"VIRT",		VAL(SIGVIRT,0),					S("Virtual timer alarm"),
230 #endif	/* SIGVIRT */
231 #ifdef SIGVTALRM
232 	"VTALRM",	VAL(SIGVTALRM,SH_SIGDONE),			S("Virtual time alarm"),
233 #endif	/* SIGVTALRM */
234 #ifdef SIGWAITING
235 	"WAITING",	VAL(SIGWAITING,SH_SIGIGNORE),			S("All threads blocked"),
236 #endif	/* SIGWAITING */
237 #ifdef SIGWINCH
238 	"WINCH",	VAL(SIGWINCH,SH_SIGIGNORE),			S("Window size change"),
239 #endif	/* SIGWINCH */
240 #ifdef SIGXCPU
241 	"XCPU",		VAL(SIGXCPU,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Exceeded CPU time limit"),
242 #endif	/* SIGXCPU */
243 #ifdef SIGXFSZ
244 	"XFSZ",		VAL(SIGXFSZ,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Exceeded file size limit"),
245 #endif	/* SIGXFSZ */
246 #ifdef SIGXRES
247 	"XRES",		VAL(SIGXRES,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Exceeded resource control"),
248 #endif	/* SIGRES */
249 	"",	0,	0
250 };
251