1 /* 2 * Copyright 2002-2011, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT license. 4 * 5 * Author: 6 * Daniel Reinhold (danielre@users.sf.net) 7 * Ingo Weinhold, ingo_weinhold@gmx.de 8 */ 9 10 11 #include <string.h> 12 13 #include <errno.h> 14 #include <signal.h> 15 #include <stdio.h> 16 17 #include <errno_private.h> 18 #include <signal_defs.h> 19 20 21 static const char* const kInvalidSignalNumberText = "Bogus signal number"; 22 23 24 const char * const 25 sys_siglist[NSIG] = { 26 /* 0 */ "Signal 0", 27 /* 1 - SIGHUP */ "Hangup", 28 /* 2 - SIGINT */ "Interrupt", 29 /* 3 - SIGQUIT */ "Quit", 30 /* 4 - SIGILL */ "Illegal instruction", 31 /* 5 - SIGCHLD */ "Child exited", 32 /* 6 - SIGABRT */ "Abort", 33 /* 7 - SIGPIPE */ "Broken pipe", 34 /* 8 - SIGFPE */ "Floating point exception", 35 /* 9 - SIGKILL */ "Killed (by death)", 36 /* 10 - SIGSTOP */ "Stopped", 37 /* 11 - SIGSEGV */ "Segmentation violation", 38 /* 12 - SIGCONT */ "Continued", 39 /* 13 - SIGTSTP */ "Stopped (tty output)", 40 /* 14 - SIGALRM */ "Alarm", 41 /* 15 - SIGTERM */ "Termination requested", 42 /* 16 - SIGTTIN */ "Stopped (tty input)", 43 /* 17 - SIGTTOU */ "Stopped (tty output)", 44 /* 18 - SIGUSR1 */ "User defined signal 1", 45 /* 19 - SIGUSR2 */ "User defined signal 2", 46 /* 20 - SIGWINCH */ "Window size changed", 47 /* 21 - SIGKILLTHR */ "Kill Thread", 48 /* 22 - SIGTRAP */ "Trace/breakpoint trap", 49 /* 23 - SIGPOLL */ "Pollable event", 50 /* 24 - SIGPROF */ "Profiling timer expired", 51 /* 25 - SIGSYS */ "Bad system call", 52 /* 26 - SIGURG */ "High bandwidth data is available at socket", 53 /* 27 - SIGVTALRM */ "Virtual timer expired", 54 /* 28 - SIGXCPU */ "CPU time limit exceeded", 55 /* 29 - SIGXFSZ */ "File size limit exceeded", 56 /* 30 - SIGBUS */ "Bus error", 57 /* 31 - SIGRESERVED1 */ "Reserved signal 1", 58 /* 32 - SIGRESERVED2 */ "Reserved signal 2", 59 /* 33 - realtime 1 */ "Realtime signal 1", 60 /* 34 - realtime 2 */ "Realtime signal 2", 61 /* 35 - realtime 3 */ "Realtime signal 3", 62 /* 36 - realtime 4 */ "Realtime signal 4", 63 /* 37 - realtime 5 */ "Realtime signal 5", 64 /* 38 - realtime 6 */ "Realtime signal 6", 65 /* 39 - realtime 7 */ "Realtime signal 7", 66 /* 40 - realtime 8 */ "Realtime signal 8", 67 /* 41 - invalid */ kInvalidSignalNumberText, 68 /* 42 - invalid */ kInvalidSignalNumberText, 69 /* 43 - invalid */ kInvalidSignalNumberText, 70 /* 44 - invalid */ kInvalidSignalNumberText, 71 /* 45 - invalid */ kInvalidSignalNumberText, 72 /* 46 - invalid */ kInvalidSignalNumberText, 73 /* 47 - invalid */ kInvalidSignalNumberText, 74 /* 48 - invalid */ kInvalidSignalNumberText, 75 /* 49 - invalid */ kInvalidSignalNumberText, 76 /* 50 - invalid */ kInvalidSignalNumberText, 77 /* 51 - invalid */ kInvalidSignalNumberText, 78 /* 52 - invalid */ kInvalidSignalNumberText, 79 /* 53 - invalid */ kInvalidSignalNumberText, 80 /* 54 - invalid */ kInvalidSignalNumberText, 81 /* 55 - invalid */ kInvalidSignalNumberText, 82 /* 56 - invalid */ kInvalidSignalNumberText, 83 /* 57 - invalid */ kInvalidSignalNumberText, 84 /* 58 - invalid */ kInvalidSignalNumberText, 85 /* 59 - invalid */ kInvalidSignalNumberText, 86 /* 60 - invalid */ kInvalidSignalNumberText, 87 /* 61 - invalid */ kInvalidSignalNumberText, 88 /* 62 - invalid */ kInvalidSignalNumberText, 89 /* 63 - invalid */ kInvalidSignalNumberText, 90 /* 64 - invalid */ kInvalidSignalNumberText 91 }; 92 93 94 const char* 95 strsignal(int sig) 96 { 97 if (sig < 0 || sig > __MAX_SIGNO) 98 return kInvalidSignalNumberText; 99 100 return sys_siglist[sig]; 101 } 102 103