]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/pidfd: fixes syscall number defines
authorOleg Nesterov <oleg@redhat.com>
Sun, 23 Mar 2025 17:45:18 +0000 (18:45 +0100)
committerChristian Brauner <brauner@kernel.org>
Tue, 25 Mar 2025 13:59:05 +0000 (14:59 +0100)
I had to spend some (a lot;) time to understand why pidfd_info_test
(and more) fails with my patch under qemu on my machine ;) Until I
applied the patch below.

I think it is a bad idea to do the things like

#ifndef __NR_clone3
#define __NR_clone3 -1
#endif

because this can hide a problem. My working laptop runs Fedora-23 which
doesn't have __NR_clone3/etc in /usr/include/. So "make" happily succeeds,
but everything fails and it is not clear why.

Link: https://lore.kernel.org/r/20250323174518.GB834@redhat.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
tools/testing/selftests/clone3/clone3_selftests.h
tools/testing/selftests/pidfd/pidfd.h

index 3d2663fe50ba56f011629e4f2eb68a72bcceb087..eeca8005723f3d0f545cd9364f1186ea184e62b5 100644 (file)
@@ -16,7 +16,7 @@
 #define ptr_to_u64(ptr) ((__u64)((uintptr_t)(ptr)))
 
 #ifndef __NR_clone3
-#define __NR_clone3 -1
+#define __NR_clone3 435
 #endif
 
 struct __clone_args {
index cec22aa11cdfe2ab2f39ac172f52da0e7d8a274e..55bcf81a2b9a265d5bcd2f29481ff8785a1ff43a 100644 (file)
 #endif
 
 #ifndef __NR_pidfd_open
-#define __NR_pidfd_open -1
+#define __NR_pidfd_open 434
 #endif
 
 #ifndef __NR_pidfd_send_signal
-#define __NR_pidfd_send_signal -1
+#define __NR_pidfd_send_signal 424
 #endif
 
 #ifndef __NR_clone3
-#define __NR_clone3 -1
+#define __NR_clone3 435
 #endif
 
 #ifndef __NR_pidfd_getfd
-#define __NR_pidfd_getfd -1
+#define __NR_pidfd_getfd 438
 #endif
 
 #ifndef PIDFD_NONBLOCK