summaryrefslogtreecommitdiffstats
path: root/siglist.c
blob: ec706c90b26ba674ab1bf68f56d1b311ec846028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
/* siglist.c -- signal list for those machines that don't have one. */

/* Copyright (C) 1989-2021 Free Software Foundation, Inc.

   This file is part of GNU Bash, the Bourne Again SHell.

   Bash is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   Bash is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with Bash.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "config.h"

#if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_UNDER_SYS_SIGLIST) && !defined (HAVE_STRSIGNAL)

#include <stdio.h>
#include "command.h"
#include "general.h"
#include <signal.h>

#include "siglist.h"

#if !defined (NSIG)
#  include "trap.h"
#endif

#include "bashintl.h"

char *sys_siglist[NSIG];

void
initialize_siglist ()
{
  register int i;

  for (i = 0; i < NSIG; i++)
    sys_siglist[i] = (char *)0x0;

  sys_siglist[0] = _("Bogus signal");

#if defined (SIGHUP)
  sys_siglist[SIGHUP] = _("Hangup");
#endif

#if defined (SIGINT)
  sys_siglist[SIGINT] = _("Interrupt");
#endif

#if defined (SIGQUIT)
  sys_siglist[SIGQUIT] = _("Quit");
#endif

#if defined (SIGILL)
  sys_siglist[SIGILL] = _("Illegal instruction");
#endif

#if defined (SIGTRAP)
  sys_siglist[SIGTRAP] = _("BPT trace/trap");
#endif

#if defined (SIGIOT) && !defined (SIGABRT)
#define SIGABRT SIGIOT
#endif

#if defined (SIGABRT)
  sys_siglist[SIGABRT] = _("ABORT instruction");
#endif

#if defined (SIGEMT)
  sys_siglist[SIGEMT] = _("EMT instruction");
#endif

#if defined (SIGFPE)
  sys_siglist[SIGFPE] = _("Floating point exception");
#endif

#if defined (SIGKILL)
  sys_siglist[SIGKILL] = _("Killed");
#endif

#if defined (SIGBUS)
  sys_siglist[SIGBUS] = _("Bus error");
#endif

#if defined (SIGSEGV)
  sys_siglist[SIGSEGV] = _("Segmentation fault");
#endif

#if defined (SIGSYS)
  sys_siglist[SIGSYS] = _("Bad system call");
#endif

#if defined (SIGPIPE)
  sys_siglist[SIGPIPE] = _("Broken pipe");
#endif

#if defined (SIGALRM)
  sys_siglist[SIGALRM] = _("Alarm clock");
#endif

#if defined (SIGTERM)
  sys_siglist[SIGTERM] = _("Terminated");
#endif

#if defined (SIGURG)
  sys_siglist[SIGURG] = _("Urgent IO condition");
#endif

#if defined (SIGSTOP)
  sys_siglist[SIGSTOP] = _("Stopped (signal)");
#endif

#if defined (SIGTSTP)
  sys_siglist[SIGTSTP] = _("Stopped");
#endif

#if defined (SIGCONT)
  sys_siglist[SIGCONT] = _("Continue");
#endif

#if !defined (SIGCHLD) && defined (SIGCLD)
#define SIGCHLD SIGCLD
#endif

#if defined (SIGCHLD)
  sys_siglist[SIGCHLD] = _("Child death or stop");
#endif

#if defined (SIGTTIN)
  sys_siglist[SIGTTIN] = _("Stopped (tty input)");
#endif

#if defined (SIGTTOU)
  sys_siglist[SIGTTOU] = _("Stopped (tty output)");
#endif

#if defined (SIGIO)
  sys_siglist[SIGIO] = _("I/O ready");
#endif

#if defined (SIGXCPU)
  sys_siglist[SIGXCPU] = _("CPU limit");
#endif

#if defined (SIGXFSZ)
  sys_siglist[SIGXFSZ] = _("File limit");
#endif

#if defined (SIGVTALRM)
  sys_siglist[SIGVTALRM] = _("Alarm (virtual)");
#endif

#if defined (SIGPROF)
  sys_siglist[SIGPROF] = _("Alarm (profile)");
#endif

#if defined (SIGWINCH)
  sys_siglist[SIGWINCH] = _("Window changed");
#endif

#if defined (SIGLOST)
  sys_siglist[SIGLOST] = _("Record lock");
#endif

#if defined (SIGUSR1)
  sys_siglist[SIGUSR1] = _("User signal 1");
#endif

#if defined (SIGUSR2)
  sys_siglist[SIGUSR2] = _("User signal 2");
#endif

#if defined (SIGMSG)
  sys_siglist[SIGMSG] = _("HFT input data pending");
#endif

#if defined (SIGPWR)
  sys_siglist[SIGPWR] = _("power failure imminent");
#endif

#if defined (SIGDANGER)
  sys_siglist[SIGDANGER] = _("system crash imminent");
#endif

#if defined (SIGMIGRATE)
  sys_siglist[SIGMIGRATE] = _("migrate process to another CPU");
#endif

#if defined (SIGPRE)
  sys_siglist[SIGPRE] = _("programming error");
#endif

#if defined (SIGGRANT)
  sys_siglist[SIGGRANT] = _("HFT monitor mode granted");
#endif

#if defined (SIGRETRACT)
  sys_siglist[SIGRETRACT] = _("HFT monitor mode retracted");
#endif

#if defined (SIGSOUND)
  sys_siglist[SIGSOUND] = _("HFT sound sequence has completed");
#endif

#if defined (SIGINFO)
  sys_siglist[SIGINFO] = _("Information request");
#endif

  for (i = 0; i < NSIG; i++)
    {
      if (!sys_siglist[i])
	{
	  sys_siglist[i] =
	    (char *)xmalloc (INT_STRLEN_BOUND (int) + 1 + strlen (_("Unknown Signal #%d")));

	  sprintf (sys_siglist[i], _("Unknown Signal #%d"), i);
	}
    }
}
#endif /* !HAVE_SYS_SIGLIST && !HAVE_UNDER_SYS_SIGLIST && !HAVE_STRSIGNAL */