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