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