printf("========= About to call close_range() =======\en");
- if (syscall(__NR_close_range, 3, \(ti0U, 0) == \-1) {
+ if (syscall(SYS_close_range, 3, \(ti0U, 0) == \-1) {
perror("close_range");
exit(EXIT_FAILURE);
}
.PP
.\" SRC BEGIN (perf_event_open.c)
.EX
-#include <stdlib.h>
+#include <linux/perf_event.h>
#include <stdio.h>
-#include <unistd.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
-#include <linux/perf_event.h>
-#include <asm/unistd.h>
+#include <sys/syscall.h>
+#include <unistd.h>
static long
perf_event_open(struct perf_event_attr *hw_event, pid_t pid,
{
int ret;
- ret = syscall(__NR_perf_event_open, hw_event, pid, cpu,
+ ret = syscall(SYS_perf_event_open, hw_event, pid, cpu,
group_fd, flags);
return ret;
}
.\" SRC BEGIN (pidfd_open.c)
.EX
#define _GNU_SOURCE
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <unistd.h>
#include <poll.h>
-#include <stdlib.h>
#include <stdio.h>
-
-#ifndef __NR_pidfd_open
-#define __NR_pidfd_open 434 /* System call # on most architectures */
-#endif
+#include <stdlib.h>
+#include <sys/syscall.h>
+#include <unistd.h>
static int
pidfd_open(pid_t pid, unsigned int flags)
{
- return syscall(__NR_pidfd_open, pid, flags);
+ return syscall(SYS_pidfd_open, pid, flags);
}
int
.\" SRC BEGIN (pidfd_send_signal.c)
.EX
#define _GNU_SOURCE
+#include <fcntl.h>
#include <limits.h>
#include <signal.h>
-#include <fcntl.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
-#include <unistd.h>
+#include <string.h>
#include <sys/syscall.h>
-
-#ifndef __NR_pidfd_send_signal
-#define __NR_pidfd_send_signal 424
-#endif
+#include <unistd.h>
static int
pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
unsigned int flags)
{
- return syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags);
+ return syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags);
}
int
static int
seccomp(unsigned int operation, unsigned int flags, void *args)
{
- return syscall(__NR_seccomp, operation, flags, args);
+ return syscall(SYS_seccomp, operation, flags, args);
}
/* The following is the x86\-64\-specific BPF boilerplate code for checking
/* mkdir() triggers notification to user\-space supervisor */
- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_mkdir, 0, 1),
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, SYS_mkdir, 0, 1),
BPF_STMT(BPF_RET + BPF_K, SECCOMP_RET_USER_NOTIF),
/* Every other system call is allowed */
code in case the seccomp filter is later modified to
generate notifications for other system calls. */
- if (req\->data.nr != __NR_mkdir) {
+ if (req\->data.nr != SYS_mkdir) {
printf("\etS: notification contained unexpected "
"system call number; bye!!!\en");
exit(EXIT_FAILURE);
/* Create and enable userfaultfd object. */
- uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK);
+ uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);
if (uffd == \-1)
errExit("userfaultfd");