source: Daodan/MinGW/include/signal.h@ 1165

Last change on this file since 1165 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 3.0 KB
Line 
1/*
2 * signal.h
3 * This file has no copyright assigned and is placed in the Public Domain.
4 * This file is a part of the mingw-runtime package.
5 * No warranty is given; refer to the file DISCLAIMER within the package.
6 *
7 * A way to set handlers for exceptional conditions (also known as signals).
8 *
9 */
10
11#ifndef _SIGNAL_H_
12#define _SIGNAL_H_
13
14/* All the headers include this file. */
15#include <_mingw.h>
16
17/*
18 * The actual signal values. Using other values with signal
19 * produces a SIG_ERR return value.
20 *
21 * NOTE: SIGINT is produced when the user presses Ctrl-C.
22 * SIGILL has not been tested.
23 * SIGFPE doesn't seem to work?
24 * SIGSEGV does not catch writing to a NULL pointer (that shuts down
25 * your app; can you say "segmentation violation core dump"?).
26 * SIGTERM comes from what kind of termination request exactly?
27 * SIGBREAK is indeed produced by pressing Ctrl-Break.
28 * SIGABRT is produced by calling abort.
29 * TODO: The above results may be related to not installing an appropriate
30 * structured exception handling frame. Results may be better if I ever
31 * manage to get the SEH stuff down.
32 */
33#define SIGINT 2 /* Interactive attention */
34#define SIGILL 4 /* Illegal instruction */
35#define SIGFPE 8 /* Floating point error */
36#define SIGSEGV 11 /* Segmentation violation */
37#define SIGTERM 15 /* Termination request */
38#define SIGBREAK 21 /* Control-break */
39#define SIGABRT 22 /* Abnormal termination (abort) */
40
41#define NSIG 23 /* maximum signal number + 1 */
42
43#ifndef RC_INVOKED
44
45#ifndef _SIG_ATOMIC_T_DEFINED
46typedef int sig_atomic_t;
47#define _SIG_ATOMIC_T_DEFINED
48#endif
49
50/*
51 * The prototypes (below) are the easy part. The hard part is figuring
52 * out what signals are available and what numbers they are assigned
53 * along with appropriate values of SIG_DFL and SIG_IGN.
54 */
55
56/*
57 * A pointer to a signal handler function. A signal handler takes a
58 * single int, which is the signal it handles.
59 */
60typedef void (*__p_sig_fn_t)(int);
61
62/*
63 * These are special values of signal handler pointers which are
64 * used to send a signal to the default handler (SIG_DFL), ignore
65 * the signal (SIG_IGN), indicate an error return (SIG_ERR),
66 * get an error (SIG_SGE), or acknowledge (SIG_ACK).
67 */
68#define SIG_DFL ((__p_sig_fn_t) 0)
69#define SIG_IGN ((__p_sig_fn_t) 1)
70#define SIG_ERR ((__p_sig_fn_t) -1)
71#define SIG_SGE ((__p_sig_fn_t) 3)
72#define SIG_ACK ((__p_sig_fn_t) 4)
73
74#ifdef __cplusplus
75extern "C" {
76#endif
77
78/*
79 * Call signal to set the signal handler for signal sig to the
80 * function pointed to by handler. Returns a pointer to the
81 * previous handler, or SIG_ERR if an error occurs. Initially
82 * unhandled signals defined above will return SIG_DFL.
83 */
84_CRTIMP __p_sig_fn_t __cdecl __MINGW_NOTHROW signal(int, __p_sig_fn_t);
85
86/*
87 * Raise the signal indicated by sig. Returns non-zero on success.
88 */
89_CRTIMP int __cdecl __MINGW_NOTHROW raise (int);
90
91#ifdef __cplusplus
92}
93#endif
94
95#endif /* Not RC_INVOKED */
96
97#endif /* Not _SIGNAL_H_ */
98
Note: See TracBrowser for help on using the repository browser.