Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics (kill unused var, and kill/improve debug outputs)
[simgrid.git] / tools / tesh2 / include / xsignal.h
1 #ifndef __XSIGNAL_H\r
2 #define __XSIGNAL_H\r
3 \r
4 #include <signal.h>\r
5 #include <com.h>\r
6 \r
7 #ifdef __cplusplus\r
8 extern "C" {\r
9 #endif\r
10 \r
11 #ifdef WIN32\r
12 \r
13 /* terminal line hangup                                                 */ \r
14 #ifndef SIGHUP\r
15 #define SIGHUP          1\r
16 #endif \r
17 \r
18 /* interrupt program                                                    */\r
19 #ifndef SIGINT\r
20 #define SIGINT          2\r
21 #endif\r
22 \r
23 /* quit program                                                                 */\r
24 #ifndef SIGQUIT\r
25 #define SIGQUIT         3\r
26 #endif\r
27 \r
28 /* illegal instruction                                                  */\r
29 #ifndef SIGILL\r
30 #define SIGILL          4\r
31 #endif\r
32 \r
33 /* trace trap                                                                   */\r
34 #ifndef SIGTRAP\r
35 #define SIGTRAP         5\r
36 #endif\r
37 \r
38 /* abnormal termination triggered by abort call */\r
39 #ifndef SIGABRT\r
40 #define SIGABRT         6\r
41 #endif\r
42 \r
43 /* floating point exception                                             */\r
44 #ifndef SIGFPE\r
45 #define SIGFPE          8\r
46 #endif\r
47 \r
48 /* kill program                                                                 */\r
49 #ifndef SIGKILL\r
50 #define SIGKILL         9\r
51 #endif\r
52 \r
53 /* bus error                                                                    */\r
54 #ifndef SIGBUS\r
55 #define SIGBUS          10\r
56 #endif\r
57 \r
58 /* segment violation                                                    */\r
59 #ifndef SIGSEGV\r
60 #define SIGSEGV         11\r
61 #endif\r
62 \r
63 /* non-existent system call invoked                             */\r
64 #ifndef SIGSYS\r
65 #define SIGSYS          12\r
66 #endif\r
67 \r
68 /* write on a pipe with no reader                               */ \r
69 #ifndef SIGPIPE\r
70 #define SIGPIPE         13\r
71 #endif\r
72 \r
73 /* real-time timer expired                                              */\r
74 #ifndef SIGALRM\r
75 #define SIGALRM         14\r
76 #endif\r
77 \r
78 /* software termination signal from kill                        */\r
79 #ifdef  SIGTERM\r
80 #define SIGTERM         15\r
81 #endif\r
82 \r
83 /* urgent condition present on socket                           */\r
84 #ifndef SIGURG\r
85 #define SIGURG          16\r
86 #endif\r
87 \r
88 /* stop (cannot be caught orignored)                            */\r
89 #ifndef SIGSTOP\r
90 #define SIGSTOP         17\r
91 #endif\r
92 \r
93 /* stop signal generated from keyboard                          */\r
94 #ifndef SIGTSTP\r
95 #define SIGTSTP         18\r
96 #endif\r
97 \r
98 /* continue after stop                                                          */\r
99 #ifndef SIGCONT\r
100 #define SIGCONT         19\r
101 #endif\r
102 \r
103 /* child status has changed                                                     */ \r
104 #ifndef SIGCHLD\r
105 #define SIGCHLD         20\r
106 #endif\r
107 \r
108 /* background read attempted from control terminal      */\r
109 #ifndef SIGTTIN\r
110 #define SIGTTIN         21\r
111 #endif\r
112 \r
113 /* background write attempted to control terminal       */\r
114 #ifndef SIGTTOU\r
115 #define SIGTTOU         22\r
116 #endif\r
117 \r
118 /* I/O is possible on a descriptor see fcntl(2))        */\r
119 #ifndef SIGIO\r
120 #define SIGIO           23\r
121 #endif\r
122 \r
123 /* cpu time limit exceeded (see setrlimit(2))           */\r
124 #ifndef SIGXCPU\r
125 #define SIGXCPU         24\r
126 #endif\r
127 \r
128 /* file size limit exceeded (see setrlimit(2))          */\r
129 #ifndef SIGXFSZ\r
130 #define SIGXFSZ         25\r
131 #endif\r
132 \r
133 /* virtual time alarm (see setitimer(2))                        */\r
134 #ifndef SIGVTALRM\r
135 #define SIGVTALRM       26\r
136 #endif\r
137 \r
138 /* profiling timer alarm (see setitimer(2))                     */\r
139 #ifndef SIGPROF\r
140 #define SIGPROF         27\r
141 #endif\r
142 \r
143 /*  window size change                                                          */\r
144 #ifndef SIGWINCH\r
145 #define SIGWINCH        28\r
146 #endif\r
147 \r
148 /* user defined signal 1                                                        */\r
149 #ifndef SIGUSR1\r
150 #define SIGUSR1         30\r
151 #endif\r
152 \r
153 /* user defined signal 2                                                        */\r
154 #ifndef SIGUSR2\r
155 #define SIGUSR2         31\r
156 #endif\r
157 \r
158 \r
159 int\r
160 is_an_unhandled_exception(DWORD exit_code);\r
161 \r
162 /*  \r
163  *return a non-zero value if status was returned for a child process that terminated normally. \r
164  */\r
165 #define WIFEXITED(__status)             !is_an_unhandled_exception((__status))\r
166 \r
167 /* if the value of WIFEXITED(__status) is non-zero, this macro evaluates the value the child \r
168  * process returned from main().\r
169  */\r
170 #define WEXITSTATUS(__status)   (__status)\r
171 \r
172 /* return a non-zero value if status was returned for a child process that terminated due to the \r
173  * receipt of a signal that was not caught \r
174  */\r
175 #define WIFSIGNALED(__status)   is_an_unhandled_exception((__status))\r
176 \r
177 /* if the value of WIFSIGNALED(__status) is non-zero, this macro evaluates to the number of the \r
178  * signal that caused the termination of the child process.\r
179  */\r
180 #define WTERMSIG(__status)              (__status)\r
181 \r
182 #endif /* WIN32 */\r
183 \r
184 \r
185 #ifdef WIN32\r
186 const char* \r
187 signal_name(DWORD got, const char* expected);\r
188 #else\r
189 const char* \r
190 signal_name(unsigned int got, char *expected);\r
191 #endif\r
192 \r
193 \r
194 int\r
195 sig_exists(const char* sig_name);\r
196 \r
197 #ifdef __cplusplus\r
198 }\r
199 #endif\r
200 \r
201 #endif /* !__XSIGNAL_H */\r