2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: signal.c /main/2 1996/05/08 19:42:38 drk $ */
24 /***************************************************************
26 * AT&T - PROPRIETARY *
28 * THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
31 * Copyright (c) 1995 AT&T Corp. *
32 * All Rights Reserved *
34 * This software is licensed by AT&T Corp. *
35 * under the terms and conditions of the license in *
36 * http://www.research.att.com/orgs/ssr/book/reuse *
38 * This software was created by the *
39 * Software Engineering Research Department *
40 * AT&T Bell Laboratories *
42 * For further information contact *
43 * gsf@research.att.com *
45 ***************************************************************/
47 /* : : generated by proto : : */
49 #if !defined(__PROTO__)
50 #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
51 #if defined(__cplusplus)
52 #define __MANGLE__ "C"
57 #define __PROTO__(x) x
59 #define __PARAM__(n,o) n
60 #if !defined(__STDC__) && !defined(__cplusplus)
61 #if !defined(c_plusplus)
72 #define __PROTO__(x) ()
73 #define __OTORP__(x) x
74 #define __PARAM__(n,o) o
82 #if defined(__cplusplus) || defined(c_plusplus)
83 #define __VARARG__ ...
87 #if defined(__STDARG__)
88 #define __VA_START__(p,a) va_start(p,a)
90 #define __VA_START__(p,a) va_start(p)
102 #define elementsof(x) (sizeof(x)/sizeof(x[0]))
104 static struct _m_ map[] =
107 "Abort", "ABRT", SIGABRT,
110 "Asynchronous I/O", "AIO", SIGAIO,
113 "Alarm call", "ALRM", SIGALRM,
116 "Apollo", "APOLLO", SIGAPOLLO,
119 "Bus error", "BUS", SIGBUS,
122 "Child status change", "CHLD", SIGCHLD,
125 "Death of child", "CLD", SIGCLD,
128 "Stopped process continued", "CONT", SIGCONT,
131 "System crash soon", "DANGER", SIGDANGER,
134 "Debug trap", "DEBUG", SIGDEBUG,
137 "DIL trap", "DIL", SIGDIL,
140 "EMT trap", "EMT", SIGEMT,
143 "ERR trap", "ERR", SIGERR,
146 "Exit", "EXIT", SIGEXIT,
149 "Floating exception", "FPE", SIGFPE,
152 "CPR freeze", "FREEZE", SIGFREEZE,
155 "Hangup", "HUP", SIGHUP,
158 "Illegal instruction", "ILL", SIGILL,
161 "Interrupt", "INT", SIGINT,
164 "IO possible", "IO", SIGIO,
167 "IOT trap", "IOT", SIGIOT,
170 "Killed", "KILL", SIGKILL,
173 "Security label changed", "LAB", SIGLAB,
176 "Resources lost", "LOST", SIGLOST,
179 "Thread event", "LWP", SIGLWP,
182 "Migrate process", "MIGRATE", SIGMIGRATE,
185 "Phone status change", "PHONE", SIGPHONE,
188 "Broken pipe", "PIPE", SIGPIPE,
191 "Poll event", "POLL", SIGPOLL,
194 "Profile timer alarm", "PROF", SIGPROF,
197 "Power fail", "PWR", SIGPWR,
200 "Quit", "QUIT", SIGQUIT,
203 "Memory fault", "SEGV", SIGSEGV,
206 "Sound completed", "SOUND", SIGSOUND,
209 "Sendable stop", "SSTOP", SIGSSTOP,
212 "Stack overflow", "STKOV", 28,
215 "Stopped (signal)", "STOP", SIGSTOP,
218 "Bad system call", "SYS", SIGSYS,
221 "Terminated", "TERM", SIGTERM,
224 "CPR thaw", "THAW", SIGTHAW,
227 "Interrupt (terminal)", "TINT", SIGTINT,
230 "Trace trap", "TRAP", SIGTRAP,
233 "Stopped", "TSTP", SIGTSTP,
236 "Stopped (tty input)", "TTIN", SIGTTIN,
239 "Stopped (tty output)", "TTOU", SIGTTOU,
242 "Urgent IO", "URG", SIGURG,
245 "User signal 1", "USR1", SIGUSR1,
248 "User signal 2", "USR2", SIGUSR2,
251 "Virtual timer alarm", "VTALRM", SIGVTALRM,
254 "All threads blocked", "WAITING", SIGWAITING,
257 "Window change", "WINCH", SIGWINCH,
260 "Window change", "WIND", SIGWIND,
263 "Window change", "WINDOW", SIGWINDOW,
266 "CPU time limit", "XCPU", SIGXCPU,
269 "File size limit", "XFSZ", SIGXFSZ,
274 #define RANGE_MIN (1<<14)
275 #define RANGE_MAX (1<<13)
276 #define RANGE_RT (1<<12)
278 #define RANGE_SIG (~(RANGE_MIN|RANGE_MAX|RANGE_RT))
280 static int index[64];
282 extern __MANGLE__ int printf __PROTO__((const char*, ...));
292 for (i = 0; map[i].name; i++)
293 if ((j = map[i].value) > 0 && j < elementsof(index) && !index[j])
305 if (j >= elementsof(index)) j = elementsof(index) - 1;
306 if (i <= j && i > 0 && i < elementsof(index) && j > 0 && j < elementsof(index))
309 index[i] = RANGE_MIN | RANGE_RT;
312 index[i] = RANGE_RT | n++;
313 index[j] = RANGE_MAX | RANGE_RT | n;
316 printf("#pragma prototyped\n");
317 printf("#define SIG_MAX %d\n", k);
319 printf("static const char* const sig_name[] =\n");
321 for (i = 0; i <= k; i++)
322 if (!(j = index[i])) printf(" \"%d\",\n", i);
323 else if (j & RANGE_RT)
325 if (j & RANGE_MIN) printf(" \"RTMIN\",\n");
326 else if (j & RANGE_MAX) printf(" \"RTMAX\",\n");
327 else printf(" \"RT%d\",\n", j & RANGE_SIG);
329 else printf(" \"%s\",\n", map[j].name);
333 printf("static const char* const sig_text[] =\n");
335 for (i = 0; i <= k; i++)
336 if (!(j = index[i])) printf(" \"Signal %d\",\n", i);
337 else if (j & RANGE_RT) printf(" \"Realtime priority %d%s\",\n", j & RANGE_SIG, (j & RANGE_MIN) ? " (lo)" : (j & RANGE_MAX) ? " (hi)" : "");
338 else printf(" \"%s\",\n", map[j].text);