Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/libbb/u_signal_names.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/libbb/u_signal_names.c
r1765 r2725 5 5 * Copyright 2006 Rob Landley <rob@landley.net> 6 6 * 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 9 10 10 #include "libbb.h" 11 11 12 static const char signals[32][7] = { 12 /* Believe it or not, but some arches have more than 32 SIGs! 13 * HPPA: SIGSTKFLT == 36. */ 14 15 static const char signals[][7] = { 13 16 // SUSv3 says kill must support these, and specifies the numerical values, 14 17 // http://www.opengroup.org/onlinepubs/009695399/utilities/kill.html 15 // TODO: "[SIG]EXIT" shouldn't work for kill, right?16 18 // {0, "EXIT"}, {1, "HUP"}, {2, "INT"}, {3, "QUIT"}, 17 19 // {6, "ABRT"}, {9, "KILL"}, {14, "ALRM"}, {15, "TERM"} … … 21 23 // {SIGCONT, "CONT"}, {SIGSTOP, "STOP"}, {SIGTSTP, "TSTP"}, {SIGTTIN, "TTIN"}, 22 24 // {SIGTTOU, "TTOU"} 25 23 26 [0] = "EXIT", 24 27 #ifdef SIGHUP … … 119 122 // Convert signal name to number. 120 123 121 int get_signum(const char *name)124 int FAST_FUNC get_signum(const char *name) 122 125 { 123 inti;126 unsigned i; 124 127 125 128 i = bb_strtou(name, NULL, 10); … … 133 136 134 137 #if ENABLE_DESKTOP && (defined(SIGIOT) || defined(SIGIO)) 135 /* These are aliased to other names */ 138 /* SIGIO[T] are aliased to other names, 139 * thus cannot be stored in the signals[] array. 140 * Need special code to recognize them */ 136 141 if ((name[0] | 0x20) == 'i' && (name[1] | 0x20) == 'o') { 137 142 #ifdef SIGIO … … 151 156 // Convert signal number to name 152 157 153 const char *get_signame(int number)158 const char* FAST_FUNC get_signame(int number) 154 159 { 155 160 if ((unsigned)number < ARRAY_SIZE(signals)) { … … 160 165 return itoa(number); 161 166 } 167 168 169 // Print the whole signal list 170 171 void FAST_FUNC print_signames(void) 172 { 173 unsigned signo; 174 175 for (signo = 1; signo < ARRAY_SIZE(signals); signo++) { 176 const char *name = signals[signo]; 177 if (name[0]) 178 puts(name); 179 } 180 }
Note:
See TracChangeset
for help on using the changeset viewer.