Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / include / signal.h
blob887150d81f3536d836db0764a05cf15753a8fa36
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.
7 * A way to set handlers for exceptional conditions (also known as signals).
9 */
11 #ifndef _SIGNAL_H_
12 #define _SIGNAL_H_
14 /* All the headers include this file. */
15 #include <_mingw.h>
18 * The actual signal values. Using other values with signal
19 * produces a SIG_ERR return value.
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.
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) */
41 #define NSIG 23 /* maximum signal number + 1 */
43 #ifndef RC_INVOKED
45 #ifndef _SIG_ATOMIC_T_DEFINED
46 typedef int sig_atomic_t;
47 #define _SIG_ATOMIC_T_DEFINED
48 #endif
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.
57 * A pointer to a signal handler function. A signal handler takes a
58 * single int, which is the signal it handles.
60 typedef void (*__p_sig_fn_t)(int);
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).
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)
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
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.
84 _CRTIMP __p_sig_fn_t __cdecl signal(int, __p_sig_fn_t);
87 * Raise the signal indicated by sig. Returns non-zero on success.
89 _CRTIMP int __cdecl raise (int);
91 #ifdef __cplusplus
93 #endif
95 #endif /* Not RC_INVOKED */
97 #endif /* Not _SIGNAL_H_ */