From: Suren Baghdasaryan <surenb@google.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: Christian Brauner <christian@brauner.io>,
arnd@arndb.de, "Eric W. Biederman" <ebiederm@xmission.com>,
Kees Cook <keescook@chromium.org>,
Joel Fernandes <joel@joelfernandes.org>,
Daniel Colascione <dancol@google.com>,
tglx@linutronix.de, Jann Horn <jannh@google.com>,
dhowells@redhat.com, mtk.manpages@gmail.com, luto@kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>,
cyphar@cyphar.com, Linus Torvalds <torvalds@linux-foundation.org>,
viro@zeniv.linux.org.uk, linux-api@vger.kernel.org,
linux-kselftest@vger.kernel.org,
kernel-team <kernel-team@android.com>
Subject: Re: [PATCH v2 1/2] tests: move common definitions and functions into pidfd.h
Date: Wed, 24 Jul 2019 17:34:04 -0700 [thread overview]
Message-ID: <CAJuCfpH0OVCjA7ST4dtQ839+gEHKT_T=t-SN=ghPO4ev-GEfYg@mail.gmail.com> (raw)
In-Reply-To: <20190725002204.185225-1-surenb@google.com>
I'm terribly sorry. I forgot to add a link to the original version of
this patch with Christian's comments. It's at:
https://lore.kernel.org/linux-kselftest/20190723173907.196488-1-surenb@google.com
and I think I addressed all comments there.
The patch should apply cleanly to the latest Linus' ToT (v5.3-rc1).
Thanks,
Suren.
On Wed, Jul 24, 2019 at 5:22 PM Suren Baghdasaryan <surenb@google.com> wrote:
>
> Move definitions and functions used across different pidfd tests into
> pidfd.h header.
>
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>
> ---
> tools/testing/selftests/pidfd/pidfd.h | 18 ++++++++++++++++++
> .../testing/selftests/pidfd/pidfd_open_test.c | 5 -----
> tools/testing/selftests/pidfd/pidfd_test.c | 10 ----------
> 3 files changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h
> index 8452e910463f..db4377af6be7 100644
> --- a/tools/testing/selftests/pidfd/pidfd.h
> +++ b/tools/testing/selftests/pidfd/pidfd.h
> @@ -16,6 +16,14 @@
>
> #include "../kselftest.h"
>
> +#ifndef __NR_pidfd_open
> +#define __NR_pidfd_open -1
> +#endif
> +
> +#ifndef __NR_pidfd_send_signal
> +#define __NR_pidfd_send_signal -1
> +#endif
> +
> /*
> * The kernel reserves 300 pids via RESERVED_PIDS in kernel/pid.c
> * That means, when it wraps around any pid < 300 will be skipped.
> @@ -53,5 +61,15 @@ int wait_for_pid(pid_t pid)
> return WEXITSTATUS(status);
> }
>
> +static inline int sys_pidfd_open(pid_t pid, unsigned int flags)
> +{
> + return syscall(__NR_pidfd_open, pid, flags);
> +}
> +
> +static inline int sys_pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
> + unsigned int flags)
> +{
> + return syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags);
> +}
>
> #endif /* __PIDFD_H */
> diff --git a/tools/testing/selftests/pidfd/pidfd_open_test.c b/tools/testing/selftests/pidfd/pidfd_open_test.c
> index 0377133dd6dc..b9fe75fc3e51 100644
> --- a/tools/testing/selftests/pidfd/pidfd_open_test.c
> +++ b/tools/testing/selftests/pidfd/pidfd_open_test.c
> @@ -22,11 +22,6 @@
> #include "pidfd.h"
> #include "../kselftest.h"
>
> -static inline int sys_pidfd_open(pid_t pid, unsigned int flags)
> -{
> - return syscall(__NR_pidfd_open, pid, flags);
> -}
> -
> static int safe_int(const char *numstr, int *converted)
> {
> char *err = NULL;
> diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c
> index 7eaa8a3de262..17b2fd621726 100644
> --- a/tools/testing/selftests/pidfd/pidfd_test.c
> +++ b/tools/testing/selftests/pidfd/pidfd_test.c
> @@ -21,10 +21,6 @@
> #include "pidfd.h"
> #include "../kselftest.h"
>
> -#ifndef __NR_pidfd_send_signal
> -#define __NR_pidfd_send_signal -1
> -#endif
> -
> #define str(s) _str(s)
> #define _str(s) #s
> #define CHILD_THREAD_MIN_WAIT 3 /* seconds */
> @@ -47,12 +43,6 @@ static pid_t pidfd_clone(int flags, int *pidfd, int (*fn)(void *))
> #endif
> }
>
> -static inline int sys_pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
> - unsigned int flags)
> -{
> - return syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags);
> -}
> -
> static int signal_received;
>
> static void set_signal_received_on_sigusr1(int sig)
> --
> 2.22.0.709.g102302147b-goog
>
next prev parent reply other threads:[~2019-07-25 0:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-25 0:22 [PATCH v2 1/2] tests: move common definitions and functions into pidfd.h Suren Baghdasaryan
2019-07-25 0:22 ` [PATCH v2 2/2] tests: add pidfd poll tests Suren Baghdasaryan
2019-07-25 11:25 ` Christian Brauner
2019-07-25 11:58 ` Yann Droneaud
2019-07-25 15:48 ` Suren Baghdasaryan
2019-07-25 20:57 ` Yann Droneaud
2019-07-25 21:10 ` Suren Baghdasaryan
2019-07-25 21:14 ` Yann Droneaud
2019-07-25 0:34 ` Suren Baghdasaryan [this message]
2019-07-25 11:26 ` [PATCH v2 1/2] tests: move common definitions and functions into pidfd.h Christian Brauner
2019-07-25 11:23 ` 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='CAJuCfpH0OVCjA7ST4dtQ839+gEHKT_T=t-SN=ghPO4ev-GEfYg@mail.gmail.com' \
--to=surenb@google.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=christian@brauner.io \
--cc=cyphar@cyphar.com \
--cc=dancol@google.com \
--cc=dhowells@redhat.com \
--cc=ebiederm@xmission.com \
--cc=jannh@google.com \
--cc=joel@joelfernandes.org \
--cc=keescook@chromium.org \
--cc=kernel-team@android.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=oleg@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).