samples: fix pidfd-metadata compilation
authorGuenter Roeck <linux@roeck-us.net>
Thu, 30 May 2019 11:40:47 +0000 (04:40 -0700)
committerChristian Brauner <christian@brauner.io>
Wed, 5 Jun 2019 13:06:07 +0000 (15:06 +0200)
Define __NR_pidfd_send_signal if it isn't to prevent a compilation error.

To make pidfd-metadata compile on all arches, irrespective of whether
or not syscall numbers are assigned, define the syscall number to -1.
If it isn't defined this will cause the kernel to return -ENOSYS.

Fixes: 43c6afee48d4 ("samples: show race-free pidfd metadata access")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: Christian Brauner <christian@brauner.io>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
[christian@brauner.io: tweak commit message]
Signed-off-by: Christian Brauner <christian@brauner.io>
samples/pidfd/pidfd-metadata.c

index 640f5f757c570709d0ca8bac4826cf7e7f031cbc..14b4544484295fee454468264957d37027a46c49 100644 (file)
 #define CLONE_PIDFD 0x00001000
 #endif
 
+#ifndef __NR_pidfd_send_signal
+#define __NR_pidfd_send_signal -1
+#endif
+
 static int do_child(void *args)
 {
        printf("%d\n", getpid());