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 @system:
19 nothrow:
20 @nogc:
21 
22 // this should be volatile
23 ///
24 alias int sig_atomic_t;
25 
26 private alias void function(int) sigfn_t;
27 
version(Posix)28 version (Posix)
29 {
30     ///
31     enum SIG_ERR    = cast(sigfn_t) -1;
32     ///
33     enum SIG_DFL    = cast(sigfn_t) 0;
34     ///
35     enum SIG_IGN    = cast(sigfn_t) 1;
36 
37     // standard C signals
38     ///
39     enum SIGABRT    = 6;  // Abnormal termination
40     ///
41     enum SIGFPE     = 8;  // Floating-point error
42     ///
43     enum SIGILL     = 4;  // Illegal hardware instruction
44     ///
45     enum SIGINT     = 2;  // Terminal interrupt character
46     ///
47     enum SIGSEGV    = 11; // Invalid memory reference
48     ///
49     enum SIGTERM    = 15; // Termination
50 }
version(Windows)51 else version (Windows)
52 {
53     ///
54     enum SIG_ERR    = cast(sigfn_t) -1;
55     ///
56     enum SIG_DFL    = cast(sigfn_t) 0;
57     ///
58     enum SIG_IGN    = cast(sigfn_t) 1;
59 
60     // standard C signals
61     ///
62     enum SIGABRT    = 22; // Abnormal termination
63     ///
64     enum SIGFPE     = 8;  // Floating-point error
65     ///
66     enum SIGILL     = 4;  // Illegal hardware instruction
67     ///
68     enum SIGINT     = 2;  // Terminal interrupt character
69     ///
70     enum SIGSEGV    = 11; // Invalid memory reference
71     ///
72     enum SIGTERM    = 15; // Termination
73 }
74 
75 ///
76 sigfn_t signal(int sig, sigfn_t func);
77 ///
78 int     raise(int sig);
79