Skip to content

Commit

Permalink
samples: fix pidfd-metadata compilation
Browse files Browse the repository at this point in the history
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: 43c6afe ("samples: show race-free pidfd metadata access")
Reported-by: Arnd Bergmann <[email protected]>
Reported-by: Guenter Roeck <[email protected]>
Cc: Christian Brauner <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
[[email protected]: tweak commit message]
Signed-off-by: Christian Brauner <[email protected]>
  • Loading branch information
groeck authored and brauner committed Jun 5, 2019
1 parent f2c7c76 commit 7c33277
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions samples/pidfd/pidfd-metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#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());
Expand Down

0 comments on commit 7c33277

Please sign in to comment.