xref: /titanic_51/usr/src/lib/libshell/common/data/signals.c (revision bbaa8b60dd95d714741fc474adad3cf710ef4efd)
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 JOBS
108 	"INT",		VAL(SIGINT,SH_SIGINTERACTIVE),			S("Interrupt"),
109 #else
110 	"INT",		VAL(SIGINT,SH_SIGINTERACTIVE),			"",
111 #endif /* JOBS */
112 #ifdef SIGIO
113 	"IO",		VAL(SIGIO,SH_SIGDONE),				S("IO signal"),
114 #endif	/* SIGIO */
115 #ifdef SIGIOT
116 	"IOT",		VAL(SIGIOT,SH_SIGDONE),				S("Abort"),
117 #endif	/* SIGIOT */
118 #ifdef SIGJVM1
119 	"JVM1",		VAL(SIGJVM1,SH_SIGIGNORE), 			S("Special signal used by Java Virtual Machine"),
120 #endif /*SIGJVM1 */
121 #ifdef SIGJVM2
122 	"JVM2",		VAL(SIGJVM2,SH_SIGIGNORE), 			S("Special signal used by Java Virtual Machine"),
123 #endif /*SIGJVM2 */
124 	"KEYBD",	VAL(TRAP(SH_KEYTRAP),0),			"",
125 #ifdef SIGKILL
126 	"KILL",		VAL(SIGKILL,0),					S("Killed"),
127 #endif /* SIGKILL */
128 #ifdef SIGLAB
129 	"LAB",		VAL(SIGLAB,0),					S("Security label changed"),
130 #endif	/* SIGLAB */
131 #ifdef SIGLOST
132 	"LOST",		VAL(SIGLOST,SH_SIGDONE),			S("Resources lost"),
133 #endif	/* SIGLOST */
134 #ifdef SIGLWP
135 	"LWP",		VAL(SIGLWP,SH_SIGIGNORE),			S("Special signal used by thread library"),
136 #endif	/* SIGLWP */
137 #ifdef SIGMIGRATE
138 	"MIGRATE",	VAL(SIGMIGRATE,0),				S("Migrate process"),
139 #endif	/* SIGMIGRATE */
140 #ifdef SIGMSG
141 	"MSG",		VAL(SIGMSG,0),					S("Ring buffer input data"),
142 #endif	/* SIGMSG */
143 #ifdef SIGPHONE
144 	"PHONE",	VAL(SIGPHONE,0),				S("Phone interrupt"),
145 #endif	/* SIGPHONE */
146 #ifdef SIGPIPE
147 #ifdef JOBS
148 	"PIPE",		VAL(SIGPIPE,SH_SIGDONE),			S("Broken Pipe"),
149 #else
150 	"PIPE",		VAL(SIGPIPE,SH_SIGDONE),	 		"",
151 #endif /* JOBS */
152 #endif /* SIGPIPE */
153 #ifdef SIGPOLL
154 	"POLL",		VAL(SIGPOLL,SH_SIGDONE),			S("Polling alarm"),
155 #endif	/* SIGPOLL */
156 #ifdef SIGPROF
157 	"PROF",		VAL(SIGPROF,SH_SIGDONE), 			S("Profiling time alarm"),
158 #endif	/* SIGPROF */
159 #ifdef SIGPRE
160 	"PRE",		VAL(SIGPRE,SH_SIGDONE), 			S("Programming exception"),
161 #endif	/* SIGPRE */
162 #ifdef SIGPWR
163 #   if SIGPWR>0
164 	"PWR",		VAL(SIGPWR,SH_SIGIGNORE),			S("Power fail"),
165 #   endif
166 #endif	/* SIGPWR */
167 #ifdef SIGQUIT
168 	"QUIT",		VAL(SIGQUIT,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Quit"),
169 #endif	/* SIGQUIT */
170 #ifdef SIGRETRACT
171 	"RETRACT",	VAL(SIGRETRACT,0),				S("Relinquish monitor mode"),
172 #endif	/* SIGRETRACT */
173 #ifdef SIGRTMIN
174 	"RTMIN",	VAL(SH_SIGRTMIN,SH_SIGRUNTIME),			S("Lowest priority realtime signal"),
175 #endif	/* SIGRTMIN */
176 #ifdef SIGRTMAX
177 	"RTMAX",	VAL(SH_SIGRTMAX,SH_SIGRUNTIME),			S("Highest priority realtime signal"),
178 #endif	/* SIGRTMAX */
179 #ifdef SIGSAK
180 	"SAK",		VAL(SIGSAK,0),					S("Secure attention key"),
181 #endif	/* SIGSAK */
182 	"SEGV",		VAL(SIGSEGV,0),					S("Memory fault"),
183 #ifdef SIGSOUND
184 	"SOUND",	VAL(SIGSOUND,0),				S("Sound completed"),
185 #endif	/* SIGSOUND */
186 #ifdef SIGSTOP
187 	"STOP",		VAL(SIGSTOP,0),					S("Stopped (SIGSTOP)"),
188 #endif	/* SIGSTOP */
189 #ifdef SIGSYS
190 	"SYS",		VAL(SIGSYS,SH_SIGDONE),				S("Bad system call"),
191 #endif	/* SIGSYS */
192 	"TERM",		VAL(SIGTERM,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Terminated"),
193 #ifdef SIGTHAW
194 	"THAW",		VAL(SIGTHAW,SH_SIGIGNORE),			S("Special signal used by CPR"),
195 #endif	/* SIGTHAW */
196 #ifdef SIGTINT
197 #   ifdef JOBS
198 	"TINT",		VAL(SIGTINT,0),					S("Interrupt"),
199 #   else
200 	"TINT",		VAL(SIGTINT,0),					"",
201 #   endif /* JOBS */
202 #endif	/* SIGTINT */
203 #ifdef SIGTRAP
204 	"TRAP",		VAL(SIGTRAP,SH_SIGDONE),			S("Trace/BPT trap"),
205 #endif	/* SIGTRAP */
206 #ifdef SIGTSTP
207 	"TSTP",		VAL(SIGTSTP,0),					S("Stopped"),
208 #endif	/* SIGTSTP */
209 #ifdef SIGTTIN
210 	"TTIN",		VAL(SIGTTIN,0),					S("Stopped (SIGTTIN)"),
211 #endif	/* SIGTTIN */
212 #ifdef SIGTTOU
213 	"TTOU",		VAL(SIGTTOU,0),					S("Stopped(SIGTTOU)"),
214 #endif	/* SIGTTOU */
215 #ifdef SIGURG
216 	"URG",		VAL(SIGURG,SH_SIGIGNORE),			S("Socket interrupt"),
217 #endif	/* SIGURG */
218 #ifdef SIGUSR1
219 	"USR1",		VAL(SIGUSR1,SH_SIGDONE),			S("User signal 1"),
220 #endif	/* SIGUSR1 */
221 #ifdef SIGUSR2
222 	"USR2",		VAL(SIGUSR2,SH_SIGDONE),	 		S("User signal 2"),
223 #endif	/* SIGUSR2 */
224 #ifdef SIGVIRT
225 	"VIRT",		VAL(SIGVIRT,0),					S("Virtual timer alarm"),
226 #endif	/* SIGVIRT */
227 #ifdef SIGVTALRM
228 	"VTALRM",	VAL(SIGVTALRM,SH_SIGDONE),			S("Virtual time alarm"),
229 #endif	/* SIGVTALRM */
230 #ifdef SIGWAITING
231 	"WAITING",	VAL(SIGWAITING,SH_SIGIGNORE),			S("All threads blocked"),
232 #endif	/* SIGWAITING */
233 #ifdef SIGWINCH
234 	"WINCH",	VAL(SIGWINCH,SH_SIGIGNORE),			S("Window size change"),
235 #endif	/* SIGWINCH */
236 #ifdef SIGXCPU
237 	"XCPU",		VAL(SIGXCPU,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Exceeded CPU time limit"),
238 #endif	/* SIGXCPU */
239 #ifdef SIGXFSZ
240 	"XFSZ",		VAL(SIGXFSZ,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Exceeded file size limit"),
241 #endif	/* SIGXFSZ */
242 #ifdef SIGXRES
243 	"XRES",		VAL(SIGXRES,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Exceeded resource control"),
244 #endif	/* SIGRES */
245 	"",	0,	0
246 };
247