xref: /titanic_41/usr/src/lib/libshell/common/data/signals.c (revision 0f1702c5201310f0529cd5abb77652e5e9b241b6)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *           Copyright (c) 1982-2007 AT&T Knowledge Ventures            *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                      by AT&T Knowledge Ventures                      *
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  */
40 
41 const struct shtable2 shtab_signals[] =
42 {
43 #ifdef SIGABRT
44 	"ABRT",		VAL(SIGABRT,SH_SIGDONE), 	S("Abort"),
45 #endif /*SIGABRT */
46 #ifdef SIGAIO
47 	"AIO",		VAL(SIGAIO,SH_SIGIGNORE), 	S("Asynchronous I/O"),
48 #endif /*SIGAIO */
49 #ifdef SIGALRM
50 	"ALRM",		VAL(SIGALRM,SH_SIGDONE),	S("Alarm call"),
51 #endif /* SIGALRM */
52 #ifdef SIGAPOLLO
53 	"APOLLO",	VAL(SIGAPOLLO,0),		"SIGAPOLLO"),
54 #endif /* SIGAPOLLO */
55 #ifdef SIGBUS
56 	"BUS",		VAL(SIGBUS,SH_SIGDONE),		S("Bus error"),
57 #endif /* SIGBUS */
58 #ifdef SIGCHLD
59 	"CHLD",		VAL(SIGCHLD,SH_SIGFAULT), 	S("Death of Child"),
60 #   ifdef SIGCLD
61 #	if SIGCLD!=SIGCHLD
62 	    "CLD",	VAL(SIGCLD,SH_SIGFAULT),	S("Death of Child"),
63 #	endif
64 #   endif	/* SIGCLD */
65 #else
66 #   ifdef SIGCLD
67 	"CLD",		VAL(SIGCLD,SH_SIGFAULT),	S("Death of Child"),
68 #   endif	/* SIGCLD */
69 #endif	/* SIGCHLD */
70 #ifdef SIGCONT
71 	"CONT",		VAL(SIGCONT,SH_SIGIGNORE),	S("Stopped process continued"),
72 #endif	/* SIGCONT */
73 	"DEBUG",	VAL(TRAP(SH_DEBUGTRAP),0),	"",
74 #ifdef SIGDIL
75 	"DIL",		VAL(SIGDIL,0),			S("DIL signal"),
76 #endif	/* SIGDIL */
77 #ifdef SIGEMT
78 	"EMT",		VAL(SIGEMT,SH_SIGDONE),		S("EMT trap"),
79 #endif	/* SIGEMT */
80 	"ERR",		VAL(TRAP(SH_ERRTRAP),0),	"",
81 #ifdef SIGERR
82 	"ERR",		VAL(SIGERR,0),			"",
83 #endif /* SIGERR */
84 	"EXIT",		VAL(0,0),			"",
85 	"FPE",		VAL(SIGFPE,SH_SIGDONE),		S("Floating exception"),
86 #ifdef SIGFREEZE
87 	"FREEZE",	VAL(SIGFREEZE,SH_SIGIGNORE),	S("Special signal used by CPR"),
88 #endif	/* SIGFREEZE */
89 	"HUP",		VAL(SIGHUP,SH_SIGDONE),		S("Hangup"),
90 	"ILL",		VAL(SIGILL,SH_SIGDONE),		S("Illegal instruction"),
91 #ifdef JOBS
92 	"INT",		VAL(SIGINT,SH_SIGINTERACTIVE),	S("Interrupt"),
93 #else
94 	"INT",		VAL(SIGINT,SH_SIGINTERACTIVE),	"",
95 #endif /* JOBS */
96 #ifdef SIGIO
97 	"IO",		VAL(SIGIO,SH_SIGIGNORE),	S("IO signal"),
98 #endif	/* SIGIO */
99 #ifdef SIGIOT
100 	"IOT",		VAL(SIGIOT,SH_SIGDONE),		S("Abort"),
101 #endif	/* SIGIOT */
102 	"KEYBD",	VAL(TRAP(SH_KEYTRAP),0),	"",
103 #ifdef SIGKILL
104 	"KILL",		VAL(SIGKILL,0),			S("Killed"),
105 #endif /* SIGKILL */
106 #ifdef SIGLAB
107 	"LAB",		VAL(SIGLAB,0),			S("Security label changed"),
108 #endif	/* SIGLAB */
109 #ifdef SIGLOST
110 	"LOST",		VAL(SIGLOST,SH_SIGDONE),	S("Resources lost"),
111 #endif	/* SIGLOST */
112 #ifdef SIGLWP
113 	"LWP",		VAL(SIGLWP,SH_SIGIGNORE),	S("Special signal used by thread library"),
114 #endif	/* SIGLWP */
115 #ifdef SIGPHONE
116 	"PHONE",	VAL(SIGPHONE,0),		S("Phone interrupt"),
117 #endif	/* SIGPHONE */
118 #ifdef SIGPIPE
119 #ifdef JOBS
120 	"PIPE",		VAL(SIGPIPE,SH_SIGDONE),	S("Broken Pipe"),
121 #else
122 	"PIPE",		VAL(SIGPIPE,SH_SIGDONE),	 "",
123 #endif /* JOBS */
124 #endif /* SIGPIPE */
125 #ifdef SIGPOLL
126 	"POLL",		VAL(SIGPOLL,SH_SIGDONE),	S("Polling alarm"),
127 #endif	/* SIGPOLL */
128 #ifdef SIGPROF
129 	"PROF",		VAL(SIGPROF,SH_SIGDONE), 	S("Profiling time alarm"),
130 #endif	/* SIGPROF */
131 #ifdef SIGPWR
132 #   if SIGPWR>0
133 	"PWR",		VAL(SIGPWR,SH_SIGIGNORE),	S("Power fail"),
134 #   endif
135 #endif	/* SIGPWR */
136 #ifdef SIGQUIT
137 	"QUIT",		VAL(SIGQUIT,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Quit"),
138 #ifdef __SIGRTMIN
139 #undef	SIGRTMIN
140 #define SIGRTMIN	__SIGRTMIN
141 #else
142 #ifdef _SIGRTMIN
143 #undef	SIGRTMIN
144 #define SIGRTMIN	_SIGRTMIN
145 #endif
146 #endif
147 #ifdef SIGRTMIN
148 	"RTMIN",	VAL(SIGRTMIN,0),		S("Lowest priority realtime signal"),
149 #endif	/* SIGRTMIN */
150 #ifdef __SIGRTMAX
151 #undef	SIGRTMAX
152 #define SIGRTMAX	__SIGRTMAX
153 #else
154 #ifdef _SIGRTMAX
155 #undef	SIGRTMAX
156 #define SIGRTMAX	_SIGRTMAX
157 #endif
158 #endif
159 #ifdef SIGRTMAX
160 	"RTMAX",	VAL(SIGRTMAX,0),		S("Highest priority realtime signal"),
161 #endif	/* SIGRTMAX */
162 #endif	/* SIGQUIT */
163 	"SEGV",		VAL(SIGSEGV,0),			S("Memory fault"),
164 #ifdef SIGSTOP
165 	"STOP",		VAL(SIGSTOP,0),			S("Stopped (SIGSTOP)"),
166 #endif	/* SIGSTOP */
167 #ifdef SIGSYS
168 	"SYS",		VAL(SIGSYS,SH_SIGDONE),		S("Bad system call"),
169 #endif	/* SIGSYS */
170 	"TERM",		VAL(SIGTERM,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Terminated"),
171 #ifdef SIGTINT
172 #   ifdef JOBS
173 	"TINT",		VAL(SIGTINT,0),			S("Interrupt"),
174 #   else
175 	"TINT",		VAL(SIGTINT,0),			"".
176 #   endif /* JOBS */
177 #endif	/* SIGTINT */
178 #ifdef SIGTRAP
179 	"TRAP",		VAL(SIGTRAP,SH_SIGDONE),	S("Trace/BPT trap"),
180 #endif	/* SIGTRAP */
181 #ifdef SIGTSTP
182 	"TSTP",		VAL(SIGTSTP,0),			S("Stopped"),
183 #endif	/* SIGTSTP */
184 #ifdef SIGTTIN
185 	"TTIN",		VAL(SIGTTIN,0),			S("Stopped (SIGTTIN)"),
186 #endif	/* SIGTTIN */
187 #ifdef SIGTTOU
188 	"TTOU",		VAL(SIGTTOU,0),			S("Stopped(SIGTTOU)"),
189 #endif	/* SIGTTOU */
190 #ifdef SIGURG
191 	"URG",		VAL(SIGURG,SH_SIGIGNORE),	S("Socket interrupt"),
192 #endif	/* SIGURG */
193 #ifdef SIGUSR1
194 	"USR1",		VAL(SIGUSR1,SH_SIGDONE),	 S("User signal 1"),
195 #endif	/* SIGUSR1 */
196 #ifdef SIGUSR2
197 	"USR2",		VAL(SIGUSR2,SH_SIGDONE),	 S("User signal 2"),
198 #endif	/* SIGUSR2 */
199 #ifdef SIGVTALRM
200 	"VTALRM",	VAL(SIGVTALRM,SH_SIGDONE),	S("Virtual time alarm"),
201 #endif	/* SIGVTALRM */
202 #ifdef SIGWINCH
203 	"WINCH",	VAL(SIGWINCH,SH_SIGIGNORE),	S("Window size change"),
204 #endif	/* SIGWINCH */
205 #ifdef SIGMIGRATE
206 	"MIGRATE",		VAL(SIGMIGRATE,0),	S("Migrate process"),
207 #endif	/* SIGMIGRATE */
208 #ifdef SIGDANGER
209 	"DANGER",		VAL(SIGDANGER,0),	S("System crash soon"),
210 #endif	/* SIGDANGER */
211 #ifdef SIGSOUND
212 	"SOUND",		VAL(SIGSOUND,0),	S("Sound completed"),
213 #endif	/* SIGSOUND */
214 #ifdef SIGTHAW
215 	"THAW",			VAL(SIGTHAW,SH_SIGIGNORE),	S("Special signal used by CPR"),
216 #endif	/* SIGTHAW */
217 #ifdef SIGWAITING
218 	"WAITING",		VAL(SIGWAITING,SH_SIGIGNORE),	S("All threads blocked"),
219 #endif	/* SIGWAITING */
220 #ifdef SIGXCPU
221 	"XCPU",		VAL(SIGXCPU,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Exceeded CPU time limit"),
222 #endif	/* SIGXCPU */
223 #ifdef SIGXFSZ
224 	"XFSZ",		VAL(SIGXFSZ,SH_SIGDONE|SH_SIGINTERACTIVE),	S("Exceeded file size limit"),
225 #endif	/* SIGXFSZ */
226 	"",	0,	0
227 };
228