Imported from ../bash-2.01.tar.gz.
[platform/upstream/bash.git] / siglist.c
1 /* siglist.c -- signal list for those machines that don't have one. */
2
3 /* Copyright (C) 1989 Free Software Foundation, Inc.
4
5 This file is part of GNU Bash, the Bourne Again SHell.
6
7 Bash is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 1, or (at your option) any later
10 version.
11
12 Bash is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License along
18 with Bash; see the file COPYING.  If not, write to the Free Software
19 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20
21 #include "config.h"
22
23 #if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_STRSIGNAL)
24
25 #include <stdio.h>
26 #include "bashtypes.h"
27 #include <signal.h>
28
29 #include "siglist.h"
30
31 #if !defined (NSIG)
32 #  include "trap.h"
33 #endif
34
35 char *sys_siglist[NSIG];
36
37 extern char *xmalloc (), *malloc ();
38
39 void
40 initialize_siglist ()
41 {
42   register int i;
43
44   for (i = 0; i < NSIG; i++)
45     sys_siglist[i] = (char *)0x0;
46
47   sys_siglist[0] = "Bogus signal";
48
49 #if defined (SIGHUP)
50   sys_siglist[SIGHUP] = "Hangup";
51 #endif
52
53 #if defined (SIGINT)
54   sys_siglist[SIGINT] = "Interrupt";
55 #endif
56
57 #if defined (SIGQUIT)
58   sys_siglist[SIGQUIT] = "Quit";
59 #endif
60
61 #if defined (SIGILL)
62   sys_siglist[SIGILL] = "Illegal instruction";
63 #endif
64
65 #if defined (SIGTRAP)
66   sys_siglist[SIGTRAP] = "BPT trace/trap";
67 #endif
68
69 #if defined (SIGIOT) && !defined (SIGABRT)
70 #define SIGABRT SIGIOT
71 #endif
72
73 #if defined (SIGABRT)
74   sys_siglist[SIGABRT] = "ABORT instruction";
75 #endif
76
77 #if defined (SIGEMT)
78   sys_siglist[SIGEMT] = "EMT instruction";
79 #endif
80
81 #if defined (SIGFPE)
82   sys_siglist[SIGFPE] = "Floating point exception";
83 #endif
84
85 #if defined (SIGKILL)
86   sys_siglist[SIGKILL] = "Killed";
87 #endif
88
89 #if defined (SIGBUS)
90   sys_siglist[SIGBUS] = "Bus error";
91 #endif
92
93 #if defined (SIGSEGV)
94   sys_siglist[SIGSEGV] = "Segmentation fault";
95 #endif
96
97 #if defined (SIGSYS)
98   sys_siglist[SIGSYS] = "Bad system call";
99 #endif
100
101 #if defined (SIGPIPE)
102   sys_siglist[SIGPIPE] = "Broken pipe";
103 #endif
104
105 #if defined (SIGALRM)
106   sys_siglist[SIGALRM] = "Alarm clock";
107 #endif
108
109 #if defined (SIGTERM)
110   sys_siglist[SIGTERM] = "Terminated";
111 #endif
112
113 #if defined (SIGURG)
114   sys_siglist[SIGURG] = "Urgent IO condition";
115 #endif
116
117 #if defined (SIGSTOP)
118   sys_siglist[SIGSTOP] = "Stopped (signal)";
119 #endif
120
121 #if defined (SIGTSTP)
122   sys_siglist[SIGTSTP] = "Stopped";
123 #endif
124
125 #if defined (SIGCONT)
126   sys_siglist[SIGCONT] = "Continue";
127 #endif
128
129 #if !defined (SIGCHLD) && defined (SIGCLD)
130 #define SIGCHLD SIGCLD
131 #endif
132
133 #if defined (SIGCHLD)
134   sys_siglist[SIGCHLD] = "Child death or stop";
135 #endif
136
137 #if defined (SIGTTIN)
138   sys_siglist[SIGTTIN] = "Stopped (tty input)";
139 #endif
140
141 #if defined (SIGTTOU)
142   sys_siglist[SIGTTOU] = "Stopped (tty output)";
143 #endif
144
145 #if defined (SIGIO)
146   sys_siglist[SIGIO] = "I/O ready";
147 #endif
148
149 #if defined (SIGXCPU)
150   sys_siglist[SIGXCPU] = "CPU limit";
151 #endif
152
153 #if defined (SIGXFSZ)
154   sys_siglist[SIGXFSZ] = "File limit";
155 #endif
156
157 #if defined (SIGVTALRM)
158   sys_siglist[SIGVTALRM] = "Alarm (virtual)";
159 #endif
160
161 #if defined (SIGPROF)
162   sys_siglist[SIGPROF] = "Alarm (profile)";
163 #endif
164
165 #if defined (SIGWINCH)
166   sys_siglist[SIGWINCH] = "Window changed";
167 #endif
168
169 #if defined (SIGLOST)
170   sys_siglist[SIGLOST] = "Record lock";
171 #endif
172
173 #if defined (SIGUSR1)
174   sys_siglist[SIGUSR1] = "User signal 1";
175 #endif
176
177 #if defined (SIGUSR2)
178   sys_siglist[SIGUSR2] = "User signal 2";
179 #endif
180
181 #if defined (SIGMSG)
182   sys_siglist[SIGMSG] = "HFT input data pending";
183 #endif
184
185 #if defined (SIGPWR)
186   sys_siglist[SIGPWR] = "power failure imminent";
187 #endif
188
189 #if defined (SIGDANGER)
190   sys_siglist[SIGDANGER] = "system crash imminent";
191 #endif
192
193 #if defined (SIGMIGRATE)
194   sys_siglist[SIGMIGRATE] = "migrate process to another CPU";
195 #endif
196
197 #if defined (SIGPRE)
198   sys_siglist[SIGPRE] = "programming error";
199 #endif
200
201 #if defined (SIGGRANT)
202   sys_siglist[SIGGRANT] = "HFT monitor mode granted";
203 #endif
204
205 #if defined (SIGRETRACT)
206   sys_siglist[SIGRETRACT] = "HFT monitor mode retracted";
207 #endif
208
209 #if defined (SIGSOUND)
210   sys_siglist[SIGSOUND] = "HFT sound sequence has completed";
211 #endif
212
213 #if defined (SIGINFO)
214   sys_siglist[SIGINFO] = "Information request";
215 #endif
216
217   for (i = 0; i < NSIG; i++)
218     {
219       if (!sys_siglist[i])
220         {
221           sys_siglist[i] =
222             (char *)xmalloc (10 + strlen ("Unknown Signal #"));
223
224           sprintf (sys_siglist[i], "Unknown Signal #%d", i);
225         }
226     }
227 }
228 #endif /* !HAVE_SYS_SIGLIST && !HAVE_STRSIGNAL */