mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <christian@brauner.io>
To: Guenter Roeck <linux@roeck-us.net>, Jann Horn <jannh@google.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] samples: pidfd: Fix compile error seen if __NR_pidfd_send_signal is undefined
Date: Thu, 30 May 2019 13:43:31 +0200	[thread overview]
Message-ID: <CAB50BEC-4816-4D92-AC46-921C62B1D344@brauner.io> (raw)
In-Reply-To: <1559216447-28355-1-git-send-email-linux@roeck-us.net>

On May 30, 2019 1:40:47 PM GMT+02:00, Guenter Roeck <linux@roeck-us.net> wrote:
>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 to cause the kernel to return -ENOSYS.
>
>Fixes: 43c6afee48d4 ("samples: show race-free pidfd metadata access")
>Cc: Christian Brauner <christian@brauner.io>
>Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>---
> samples/pidfd/pidfd-metadata.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
>diff --git a/samples/pidfd/pidfd-metadata.c
>b/samples/pidfd/pidfd-metadata.c
>index 640f5f757c57..1e125ddde268 100644
>--- a/samples/pidfd/pidfd-metadata.c
>+++ b/samples/pidfd/pidfd-metadata.c
>@@ -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());

Couldn't you just use the actual syscall number? 
That should still fail if the kernel is to old 
and still work on kernels that support it
but for whatever reason the unistd.h h
header doesn't have it defined.

Thanks!
Christian

  reply	other threads:[~2019-05-30 11:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 11:40 Guenter Roeck
2019-05-30 11:43 ` Christian Brauner [this message]
2019-05-30 11:50   ` Guenter Roeck
2019-05-30 11:55     ` Christian Brauner
2019-05-30 12:29       ` Guenter Roeck
2019-05-30 12:34         ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAB50BEC-4816-4D92-AC46-921C62B1D344@brauner.io \
    --to=christian@brauner.io \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®