-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathWin32_Signal_Process.h
105 lines (92 loc) · 3.58 KB
/
Win32_Signal_Process.h
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* Copyright (c), Microsoft Open Technologies, Inc.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WIN32_INTEROP_SIGNALPROCESS_H
#define WIN32_INTEROP_SIGNALPROCESS_H
#include "win32_types.h"
#include <stdlib.h>
#include <signal.h>
#include <process.h>
#include <WinSock2.h>
/* rusage */
#define RUSAGE_SELF 0
#define RUSAGE_CHILDREN (-1)
#ifndef _RUSAGE_T_
#define _RUSAGE_T_
struct rusage {
struct timeval ru_utime; /* user time used */
struct timeval ru_stime; /* system time used */
};
#endif
int getrusage(int who, struct rusage * rusage);
/* Signals */
#define SIGNULL 0 /* Null Check access to pid*/
#define SIGHUP 1 /* Hangup Terminate; can be trapped*/
#define SIGINT 2 /* Interrupt Terminate; can be trapped */
#define SIGQUIT 3 /* Quit Terminate with core dump; can be trapped */
#define SIGTRAP 5
#define SIGBUS 7
#define SIGKILL 9 /* Kill Forced termination; cannot be trapped */
#define SIGPIPE 13
#define SIGALRM 14
#define SIGTERM 15 /* Terminate Terminate; can be trapped */
#define SIGSTOP 17
#define SIGTSTP 18
#define SIGCONT 19
#define SIGCHLD 20
#define SIGTTIN 21
#define SIGTTOU 22
#define SIGABRT 22
/* #define SIGSTOP 24 /*Pause the process; cannot be trapped*/
/* #define SIGTSTP 25 /*Terminal stop Pause the process; can be trapped*/
/* #define SIGCONT 26 /* */
#define SIGWINCH 28
#define SIGUSR1 30
#define SIGUSR2 31
#define SA_NOCLDSTOP 0x00000001u
#define SA_NOCLDWAIT 0x00000002u
#define SA_SIGINFO 0x00000004u
#define SA_ONSTACK 0x08000000u
#define SA_RESTART 0x10000000u
#define SA_NODEFER 0x40000000u
#define SA_RESETHAND 0x80000000u
#define SA_NOMASK SA_NODEFER
#define SA_ONESHOT SA_RESETHAND
#define SA_RESTORER 0x04000000
#define sigemptyset(pset) (*(pset) = 0)
#define sigfillset(pset) (*(pset) = (unsigned int)-1)
#define sigaddset(pset, num) (*(pset) |= (1L<<(num)))
#define sigdelset(pset, num) (*(pset) &= ~(1L<<(num)))
#define sigismember(pset, num) (*(pset) & (1L<<(num)))
typedef void(*__p_sig_fn_t)(int);
#ifndef _SIGSET_T_
#define _SIGSET_T_
typedef size_t _sigset_t;
#define sigset_t _sigset_t
#endif /* _SIGSET_T_ */
struct sigaction {
int sa_flags;
sigset_t sa_mask;
__p_sig_fn_t sa_handler;
__p_sig_fn_t sa_sigaction;
};
int sigaction(int sig, struct sigaction *in, struct sigaction *out);
#endif