summaryrefslogtreecommitdiff
path: root/libphobos/libdruntime/core/stdc/signal.d
blob: 13c6f9efbe80e25eba9e0182116be9c1cb1579ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/**
 * D header file for C99.
 *
 * $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_signal.h.html, _signal.h)
 *
 * Copyright: Copyright Sean Kelly 2005 - 2009.
 * License: Distributed under the
 *      $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
 *    (See accompanying file LICENSE)
 * Authors:   Sean Kelly
 * Source:    $(DRUNTIMESRC core/stdc/_signal.d)
 * Standards: ISO/IEC 9899:1999 (E)
 */

module core.stdc.signal;

extern (C):
nothrow:
@nogc:

// this should be volatile
///
alias int sig_atomic_t;

private alias void function(int) sigfn_t;

version (Posix)
{
    ///
    enum SIG_ERR    = cast(sigfn_t) -1;
    ///
    enum SIG_DFL    = cast(sigfn_t) 0;
    ///
    enum SIG_IGN    = cast(sigfn_t) 1;

    // standard C signals
    ///
    enum SIGABRT    = 6;  // Abnormal termination
    ///
    enum SIGFPE     = 8;  // Floating-point error
    ///
    enum SIGILL     = 4;  // Illegal hardware instruction
    ///
    enum SIGINT     = 2;  // Terminal interrupt character
    ///
    enum SIGSEGV    = 11; // Invalid memory reference
    ///
    enum SIGTERM    = 15; // Termination
}
else version (Windows)
{
    ///
    enum SIG_ERR    = cast(sigfn_t) -1;
    ///
    enum SIG_DFL    = cast(sigfn_t) 0;
    ///
    enum SIG_IGN    = cast(sigfn_t) 1;

    // standard C signals
    ///
    enum SIGABRT    = 22; // Abnormal termination
    ///
    enum SIGFPE     = 8;  // Floating-point error
    ///
    enum SIGILL     = 4;  // Illegal hardware instruction
    ///
    enum SIGINT     = 2;  // Terminal interrupt character
    ///
    enum SIGSEGV    = 11; // Invalid memory reference
    ///
    enum SIGTERM    = 15; // Termination
}

///
sigfn_t signal(int sig, sigfn_t func);
///
int     raise(int sig);