blob: dd4abde71497b239971d10b77a57401d7bef1409 (
plain) (
blame)
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
|
#ifndef __APPLE__
#include <stdint.h>
#include <stdio.h>
#include <sys/syscall.h>
#include <unistd.h>
#include "debug.h"
#include "seccomp.h"
int seccomp_event_create(void) {
int fd = syscall(SYS_eventfd, 0, 0);
if (fd < 0) { FATAL("seccomp_event_create"); }
return fd;
}
void seccomp_event_signal(int fd) {
uint64_t val = 1;
if (write(fd, &val, sizeof(uint64_t)) != sizeof(uint64_t)) {
FATAL("seccomp_event_signal");
}
}
void seccomp_event_wait(int fd) {
uint64_t val = 1;
if (read(fd, &val, sizeof(uint64_t)) != sizeof(uint64_t)) {
FATAL("seccomp_event_wait");
}
}
void seccomp_event_destroy(int fd) {
if (close(fd) < 0) { FATAL("seccomp_event_destroy"); }
}
#endif
|