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