Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Alessandro Zanni <alessandro.zanni87@gmail.com>
To: brauner@kernel.org, shuah@kernel.org
Cc: Alessandro Zanni <alessandro.zanni87@gmail.com>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH] selftests: pid_namespace and pidfd missing include
Date: Tue, 28 Jan 2025 18:04:45 +0100	[thread overview]
Message-ID: <20250128170447.12918-1-alessandro.zanni87@gmail.com> (raw)

Running "make kselftest" results in several errors like these:

pidfd_fdinfo_test.c:231:36: error: ‘MS_REC’ undeclared (first use in
this function)
  231 |         r = mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, 0);

pidfd_fdinfo_test.c:231:45: error: ‘MS_PRIVATE’ undeclared (first use
in this function); did you mean ‘MAP_PRIVATE’?
  231 |         r = mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, 0);

pid_max.c:48:9: warning: implicit declaration of function ‘umount2’;
did you mean ‘SYS_umount2’? [-Wimplicit-function-declaration]
   48 |         umount2("/proc", MNT_DETACH);

This patch adds the <sys/mount.h> include in pidfd_fdinfo_test.c and
pid_max.c files to find the variables MS_REC, MS_PRIVATE, MNT_DETACH.

Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>
---
 tools/testing/selftests/pid_namespace/pid_max.c   | 1 +
 tools/testing/selftests/pidfd/pidfd_fdinfo_test.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/tools/testing/selftests/pid_namespace/pid_max.c b/tools/testing/selftests/pid_namespace/pid_max.c
index 51c414faabb0..972bedc475f1 100644
--- a/tools/testing/selftests/pid_namespace/pid_max.c
+++ b/tools/testing/selftests/pid_namespace/pid_max.c
@@ -11,6 +11,7 @@
 #include <string.h>
 #include <syscall.h>
 #include <sys/wait.h>
+#include <sys/mount.h>
 
 #include "../kselftest_harness.h"
 #include "../pidfd/pidfd.h"
diff --git a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c
index f062a986e382..f718aac75068 100644
--- a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c
+++ b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c
@@ -13,6 +13,7 @@
 #include <syscall.h>
 #include <sys/wait.h>
 #include <sys/mman.h>
+#include <sys/mount.h>
 
 #include "pidfd.h"
 #include "../kselftest.h"
-- 
2.43.0


             reply	other threads:[~2025-01-28 17:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28 17:04 Alessandro Zanni [this message]
2025-02-13  0:24 ` [PATCH] selftests: pid_namespace and pidfd missing include Alessandro Zanni
2025-02-19  0:26   ` Shuah Khan
2025-02-20 16:42     ` Peter Seiderer

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=20250128170447.12918-1-alessandro.zanni87@gmail.com \
    --to=alessandro.zanni87@gmail.com \
    --cc=brauner@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /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