2 #include <sanitizer/linux_syscall_hooks.h>
4 #include <sys/syscall.h>
9 __sanitizer_syscall_pre_fork();
11 int res
= syscall(SYS_fork
);
13 int res
= syscall(SYS_clone
, SIGCHLD
, 0);
15 __sanitizer_syscall_post_fork(res
);
19 int mypipe(int pipefd
[2]) {
20 __sanitizer_syscall_pre_pipe(pipefd
);
21 int res
= syscall(SYS_pipe2
, pipefd
, 0);
22 __sanitizer_syscall_post_pipe(res
, pipefd
);
27 __sanitizer_syscall_pre_close(fd
);
28 int res
= syscall(SYS_close
, fd
);
29 __sanitizer_syscall_post_close(res
, fd
);
33 ssize_t
myread(int fd
, void *buf
, size_t count
) {
34 __sanitizer_syscall_pre_read(fd
, buf
, count
);
35 ssize_t res
= syscall(SYS_read
, fd
, buf
, count
);
36 __sanitizer_syscall_post_read(res
, fd
, buf
, count
);
40 ssize_t
mywrite(int fd
, const void *buf
, size_t count
) {
41 __sanitizer_syscall_pre_write(fd
, buf
, count
);
42 ssize_t res
= syscall(SYS_write
, fd
, buf
, count
);
43 __sanitizer_syscall_post_write(res
, fd
, buf
, count
);