]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
Various pages: EXAMPLES: Use SYS_xxx syscall macros instead of __NR_xxx
authorAlejandro Colomar <alx.manpages@gmail.com>
Mon, 2 May 2022 21:14:30 +0000 (23:14 +0200)
committerAlejandro Colomar <alx.manpages@gmail.com>
Mon, 2 May 2022 21:15:22 +0000 (23:15 +0200)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
man2/close_range.2
man2/perf_event_open.2
man2/pidfd_open.2
man2/pidfd_send_signal.2
man2/seccomp_unotify.2
man2/userfaultfd.2

index 1e5278d1694f29ddb9acbda629e215986b04e33e..8f3214b4394d5ca35147194094844937409a8847 100644 (file)
@@ -255,7 +255,7 @@ main(int argc, char *argv[])
 
     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);
     }
index 8eae40583cd905e288ca375a584c5668700f8d64..cafed229710990a3c9d22aba060093692a306ecf 100644 (file)
@@ -3727,13 +3727,13 @@ instruction count of a call to
 .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,
@@ -3741,7 +3741,7 @@ 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;
 }
index 504d937dd471d692b543c4394077c53fcd1eefe5..8a003b62d5e18dc7f095f5a83c09f9cc2642a91e 100644 (file)
@@ -212,21 +212,16 @@ event.
 .\" 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
index 12b44054c90e41d5161f71a92278fa6c2cf8af36..7f23bcc1dbbbde78e936f5ec4f7bea13296fa2b4 100644 (file)
@@ -170,24 +170,20 @@ fails with the error
 .\" 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
index 25d4c5bec5777f961c6dff1f61ca428fe206fac5..db4597cb2f55d4aa64d2c4559fc7521849df1910 100644 (file)
@@ -1549,7 +1549,7 @@ sigchldHandler(int sig)
 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
@@ -1585,7 +1585,7 @@ installNotifyFilter(void)
 
         /* 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 */
@@ -1841,7 +1841,7 @@ handleNotifications(int notifyFd)
            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);
index aba0093ecf39e88c737bcca97de9d10aa46a23f0..d2456a61a23069da645fb0f82cef775009014620 100644 (file)
@@ -868,7 +868,7 @@ main(int argc, char *argv[])
 
     /* 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");