| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#ifndef H2_SUBREAPER_IMPL_H |
|
2
|
|
|
|
|
|
|
#define H2_SUBREAPER_IMPL_H |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
#include |
|
5
|
|
|
|
|
|
|
#include |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#if defined(__linux__) |
|
8
|
|
|
|
|
|
|
# include |
|
9
|
|
|
|
|
|
|
# ifdef PR_SET_CHILD_SUBREAPER |
|
10
|
|
|
|
|
|
|
# define H2_SUBREAPER_HAVE 1 |
|
11
|
|
|
|
|
|
|
# define H2_SUBREAPER_MECHANISM "prctl" |
|
12
|
0
|
|
|
|
|
|
static int h2_subreaper_set(int on) { |
|
13
|
0
|
|
|
|
|
|
return prctl(PR_SET_CHILD_SUBREAPER, on ? 1 : 0, 0, 0, 0) == 0 ? 1 : 0; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
# endif |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#elif defined(__FreeBSD__) || defined(__DragonFly__) |
|
18
|
|
|
|
|
|
|
# include |
|
19
|
|
|
|
|
|
|
# include |
|
20
|
|
|
|
|
|
|
# if defined(PROC_REAP_ACQUIRE) && defined(PROC_REAP_RELEASE) |
|
21
|
|
|
|
|
|
|
# define H2_SUBREAPER_HAVE 1 |
|
22
|
|
|
|
|
|
|
# define H2_SUBREAPER_MECHANISM "procctl" |
|
23
|
|
|
|
|
|
|
static int h2_subreaper_set(int on) { |
|
24
|
|
|
|
|
|
|
int cmd = on ? PROC_REAP_ACQUIRE : PROC_REAP_RELEASE; |
|
25
|
|
|
|
|
|
|
return procctl(P_PID, getpid(), cmd, NULL) == 0 ? 1 : 0; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
# endif |
|
28
|
|
|
|
|
|
|
#endif |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#ifndef H2_SUBREAPER_HAVE |
|
31
|
|
|
|
|
|
|
# define H2_SUBREAPER_HAVE 0 |
|
32
|
|
|
|
|
|
|
# define H2_SUBREAPER_MECHANISM NULL |
|
33
|
|
|
|
|
|
|
static int h2_subreaper_set(int on) { |
|
34
|
|
|
|
|
|
|
(void)on; |
|
35
|
|
|
|
|
|
|
errno = ENOSYS; |
|
36
|
|
|
|
|
|
|
return 0; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
#endif |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
#endif /* H2_SUBREAPER_IMPL_H */ |