1 /**
2  * D header file for C99.
3  *
4  * $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_signal.h.html, _signal.h)
5  *
6  * Copyright: Copyright Sean Kelly 2005 - 2009.
7  * License: Distributed under the
8  *      $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
9  *    (See accompanying file LICENSE)
10  * Authors:   Sean Kelly
11  * Source:    $(DRUNTIMESRC core/stdc/_signal.d)
12  * Standards: ISO/IEC 9899:1999 (E)
13  */
14 
15 module core.stdc.signal;
16 
17 extern (C):
18 nothrow:
19 @nogc:
20 
21 // this should be volatile
22 ///
23 alias int sig_atomic_t;
24 
25 private alias void function(int) sigfn_t;
26 
27 version (Posix)
28 {
29     ///
30     enum SIG_ERR    = cast(sigfn_t) -1;
31     ///
32     enum SIG_DFL    = cast(sigfn_t) 0;
33     ///
34     enum SIG_IGN    = cast(sigfn_t) 1;
35 
36     // standard C signals
37     ///
38     enum SIGABRT    = 6;  // Abnormal termination
39     ///
40     enum SIGFPE     = 8;  // Floating-point error
41     ///
42     enum SIGILL     = 4;  // Illegal hardware instruction
43     ///
44     enum SIGINT     = 2;  // Terminal interrupt character
45     ///
46     enum SIGSEGV    = 11; // Invalid memory reference
47     ///
48     enum SIGTERM    = 15; // Termination
49 }
50 else version (Windows)
51 {
52     ///
53     enum SIG_ERR    = cast(sigfn_t) -1;
54     ///
55     enum SIG_DFL    = cast(sigfn_t) 0;
56     ///
57     enum SIG_IGN    = cast(sigfn_t) 1;
58 
59     // standard C signals
60     ///
61     enum SIGABRT    = 22; // Abnormal termination
62     ///
63     enum SIGFPE     = 8;  // Floating-point error
64     ///
65     enum SIGILL     = 4;  // Illegal hardware instruction
66     ///
67     enum SIGINT     = 2;  // Terminal interrupt character
68     ///
69     enum SIGSEGV    = 11; // Invalid memory reference
70     ///
71     enum SIGTERM    = 15; // Termination
72 }
73 
74 ///
75 sigfn_t signal(int sig, sigfn_t func);
76 ///
77 int     raise(int sig);