VirtualBox

source: kBuild/trunk/src/kash/sys_signame.c@ 3408

Last change on this file since 3408 was 3408, checked in by bird, 4 years ago

kash: Don't use sys_siglist, use strsignal instead. Should be present everywhere except when using VC++ on windows.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1/*
2 * Fake sys_signame.
3 */
4
5#include "shinstance.h" /* for MSC */
6#include <string.h>
7#include <stdio.h>
8
9static char sys_signame_initialized = 0;
10char sys_signame[NSIG][16];
11
12void init_sys_signame(void)
13{
14 unsigned i;
15 if (sys_signame_initialized)
16 return;
17 for (i = 0; i < NSIG; ++i)
18 sprintf(sys_signame[i], "%d", i);
19#define SET_SIG_STR(sig) strcpy(sys_signame[SIG##sig], #sig);
20#ifdef SIGHUP
21 SET_SIG_STR(HUP);
22#endif
23#ifdef SIGINT
24 SET_SIG_STR(INT);
25#endif
26#ifdef SIGQUIT
27 SET_SIG_STR(QUIT);
28#endif
29#ifdef SIGILL
30 SET_SIG_STR(ILL);
31#endif
32#ifdef SIGTRAP
33 SET_SIG_STR(TRAP);
34#endif
35#ifdef SIGABRT
36 SET_SIG_STR(ABRT);
37#endif
38#ifdef SIGIOT
39 SET_SIG_STR(IOT);
40#endif
41#ifdef SIGBUS
42 SET_SIG_STR(BUS);
43#endif
44#ifdef SIGFPE
45 SET_SIG_STR(FPE);
46#endif
47#ifdef SIGKILL
48 SET_SIG_STR(KILL);
49#endif
50#ifdef SIGUSR1
51 SET_SIG_STR(USR1);
52#endif
53#ifdef SIGSEGV
54 SET_SIG_STR(SEGV);
55#endif
56#ifdef SIGUSR2
57 SET_SIG_STR(USR2);
58#endif
59#ifdef SIGPIPE
60 SET_SIG_STR(PIPE);
61#endif
62#ifdef SIGALRM
63 SET_SIG_STR(ALRM);
64#endif
65#ifdef SIGTERM
66 SET_SIG_STR(TERM);
67#endif
68#ifdef SIGSTKFLT
69 SET_SIG_STR(STKFLT);
70#endif
71#ifdef SIGCHLD
72 SET_SIG_STR(CHLD);
73#endif
74#ifdef SIGCONT
75 SET_SIG_STR(CONT);
76#endif
77#ifdef SIGSTOP
78 SET_SIG_STR(STOP);
79#endif
80#ifdef SIGTSTP
81 SET_SIG_STR(TSTP);
82#endif
83#ifdef SIGTTIN
84 SET_SIG_STR(TTIN);
85#endif
86#ifdef SIGTTOU
87 SET_SIG_STR(TTOU);
88#endif
89#ifdef SIGURG
90 SET_SIG_STR(URG);
91#endif
92#ifdef SIGXCPU
93 SET_SIG_STR(XCPU);
94#endif
95#ifdef SIGXFSZ
96 SET_SIG_STR(XFSZ);
97#endif
98#ifdef SIGVTALRM
99 SET_SIG_STR(VTALRM);
100#endif
101#ifdef SIGPROF
102 SET_SIG_STR(PROF);
103#endif
104#ifdef SIGWINCH
105 SET_SIG_STR(WINCH);
106#endif
107#ifdef SIGIO
108 SET_SIG_STR(IO);
109#endif
110#ifdef SIGPWR
111 SET_SIG_STR(PWR);
112#endif
113#ifdef SIGSYS
114 SET_SIG_STR(SYS);
115#endif
116#ifdef SIGBREAK
117 SET_SIG_STR(BREAK);
118#endif
119#undef SET_SIG_STR
120 sys_signame_initialized = 1;
121}
122
123#if defined(_MSC_VER)
124const char *strsignal(int iSig)
125{
126 if (!sys_signame_initialized)
127 init_sys_signame();
128 if (iSig < NSIG)
129 return sys_signame(iSig);
130 return NULL;
131}
132#endif
133
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette