-
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathcsignal
More file actions
87 lines (69 loc) · 1.62 KB
/
Copy pathcsignal
File metadata and controls
87 lines (69 loc) · 1.62 KB
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
78
79
80
81
82
83
84
85
86
87
//==============================================================================
//
// csignal
//
#ifndef CSIGNAL_INCLUDED
#define CSIGNAL_INCLUDED
#include "cstddef"
#define SIGABRT 6
#define SIGINT 2
#define SIGILL 4
#define SIGFPE 8
#define SIGSEGV 11
#define SIGTERM 15
#ifdef OS_LINUX
#define SIGBUS 7
#endif
#ifdef OS_WIN
#define SIGBREAK 21
#endif
typedef void (*sighandler)(int sig);
void* signal(int sig, sighandler handler);
int raise(int sig);
#ifdef OS_LINUX
enum
{
SEGV_MAPERR = 1,
SEGV_ACCERR,
SEGV_BNDERR,
SEGV_PKUERR,
SEGV_ACCADI,
SEGV_ADIDERR,
SEGV_ADIPERR
};
struct siginfo_t
{
int si_signo; // signal number
int si_errno; // from errno.h
int si_code; // specifies field(s) with further info
// Fields for SIGILL, SIGFPE, SIGSEGV, and SIGBUS.
//
void* si_addr;
short si_addr_lsb;
void* si_lower; // si_code is SEGV_BNDERR
void* si_upper; // si_code is SEGV_BNDERR
uint32_t si_pkey; // si_code is SEGV_PKUERR
};
typedef void (*sigacthandler)(int signo, siginfo_t* info, void* unused);
constexpr int SIGSET_NWORDS = (1024 / (8 * sizeof (unsigned long)));
struct sigset_t
{
unsigned long int val[SIGSET_NWORDS];
};
int sigemptyset(sigset_t* set);
constexpr int SA_SIGINFO = 4;
constexpr int SA_NODEFER = 0x40000000;
constexpr int SA_RESETHAND = 0x80000000;
struct sigaction
{
union
{
sighandler sa_handler; // used if SA_SIGINFO not set
sigacthandler sa_sigaction; // used if SA_SIGINFO set
};
sigset_t sa_mask;
int sa_flags;
};
int sigaction(int signo, const struct sigaction* act, struct sigaction* oact);
#endif
#endif