Unverified Commit 7c33277b authored by Guenter Roeck's avatar Guenter Roeck Committed by Christian Brauner
Browse files

samples: fix pidfd-metadata compilation



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: 43c6afee ("samples: show race-free pidfd metadata access")
Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
Cc: Christian Brauner <christian@brauner.io>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
[christian@brauner.io: tweak commit message]
Signed-off-by: default avatarChristian Brauner <christian@brauner.io>
parent f2c7c76c
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,10 @@
#define CLONE_PIDFD 0x00001000
#define CLONE_PIDFD 0x00001000
#endif
#endif


#ifndef __NR_pidfd_send_signal
#define __NR_pidfd_send_signal -1
#endif

static int do_child(void *args)
static int do_child(void *args)
{
{
	printf("%d\n", getpid());
	printf("%d\n", getpid());