public inbox for linux-kselftest@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] selftests/pid_namespace: fix building with clang-20
@ 2025-03-11 16:07 Dmitry Antipov
  2025-03-11 16:07 ` [PATCH 2/2] selftests/pidfd: " Dmitry Antipov
  2025-03-18 15:08 ` [PATCH 1/2] selftests/pid_namespace: " Peter Seiderer
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Antipov @ 2025-03-11 16:07 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linux-kselftest, lvc-project, Dmitry Antipov

When using 'make LLVM=1 W=1 -C tools/testing/selftests/pid_namespace'
with clang-20, I've noticed the following:

pid_max.c:42:8: error: call to undeclared function 'mount'; ISO
C99 and later do not support implicit function declarations
[-Wimplicit-function-declaration]
   42 |         ret = mount("", "/", NULL, MS_PRIVATE | MS_REC, 0);
      |               ^
pid_max.c:42:29: error: use of undeclared identifier 'MS_PRIVATE'
   42 |         ret = mount("", "/", NULL, MS_PRIVATE | MS_REC, 0);
      |                                    ^
...

So include '<sys/mount.h>' to add all of the required declarations.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 tools/testing/selftests/pid_namespace/pid_max.c | 1 +
 1 file changed, 1 insertion(+)

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"
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] selftests/pidfd: fix building with clang-20
  2025-03-11 16:07 [PATCH 1/2] selftests/pid_namespace: fix building with clang-20 Dmitry Antipov
@ 2025-03-11 16:07 ` Dmitry Antipov
  2025-03-18 15:08 ` [PATCH 1/2] selftests/pid_namespace: " Peter Seiderer
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Antipov @ 2025-03-11 16:07 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linux-kselftest, lvc-project, Dmitry Antipov

When using 'make LLVM=1 W=1 -C tools/testing/selftests/pidfd' with
clang-20, I've noticed the following:

pidfd_fdinfo_test.c:230:6: error: call to undeclared function 'mount';
ISO C99 and later do not support implicit function declarations
[-Wimplicit-function-declaration]
  230 |         r = mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, 0);
      |             ^
pidfd_fdinfo_test.c:230:29: error: use of undeclared identifier 'MS_REC'
  230 |         r = mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, 0);
      |                                    ^

and:

pidfd_setns_test.c:172:40: error: call to undeclared function 'ioctl';
ISO C99 and later do not support implicit function declarations
[-Wimplicit-function-declaration]
  172 |                 self->child_pidfd_derived_nsfds[i] = \
                               ioctl(self->pidfd, info->pidfd_ioctl, 0);
      |                        ^

So include '<sys/mount.h>' and 'sys/ioctl.h', respectively,
to add all of the required declarations.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 tools/testing/selftests/pidfd/pidfd_fdinfo_test.c | 1 +
 tools/testing/selftests/pidfd/pidfd_setns_test.c  | 1 +
 2 files changed, 2 insertions(+)

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"
diff --git a/tools/testing/selftests/pidfd/pidfd_setns_test.c b/tools/testing/selftests/pidfd/pidfd_setns_test.c
index 222f8131283b..9b0cebe263bc 100644
--- a/tools/testing/selftests/pidfd/pidfd_setns_test.c
+++ b/tools/testing/selftests/pidfd/pidfd_setns_test.c
@@ -16,6 +16,7 @@
 #include <unistd.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
+#include <sys/ioctl.h>
 #include <linux/ioctl.h>
 
 #include "pidfd.h"
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] selftests/pid_namespace: fix building with clang-20
  2025-03-11 16:07 [PATCH 1/2] selftests/pid_namespace: fix building with clang-20 Dmitry Antipov
  2025-03-11 16:07 ` [PATCH 2/2] selftests/pidfd: " Dmitry Antipov
@ 2025-03-18 15:08 ` Peter Seiderer
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Seiderer @ 2025-03-18 15:08 UTC (permalink / raw)
  To: Dmitry Antipov
  Cc: Shuah Khan, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
	Justin Stitt, linux-kselftest, lvc-project

Hello Dmitry,

On Tue, 11 Mar 2025 19:07:05 +0300, Dmitry Antipov <dmantipov@yandex.ru> wrote:

> When using 'make LLVM=1 W=1 -C tools/testing/selftests/pid_namespace'
> with clang-20, I've noticed the following:
>
> pid_max.c:42:8: error: call to undeclared function 'mount'; ISO
> C99 and later do not support implicit function declarations
> [-Wimplicit-function-declaration]
>    42 |         ret = mount("", "/", NULL, MS_PRIVATE | MS_REC, 0);
>       |               ^
> pid_max.c:42:29: error: use of undeclared identifier 'MS_PRIVATE'
>    42 |         ret = mount("", "/", NULL, MS_PRIVATE | MS_REC, 0);
>       |                                    ^
> ...
>
> So include '<sys/mount.h>' to add all of the required declarations.
>
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
>  tools/testing/selftests/pid_namespace/pid_max.c | 1 +
>  1 file changed, 1 insertion(+)
>
> 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"

Predated patches already available, see

        https://lore.kernel.org/linux-kselftest/20250115105211.390370-1-ps.report@gmx.net/
        https://lore.kernel.org/linux-kselftest/20250115105211.390370-2-ps.report@gmx.net/
	https://lore.kernel.org/linux-kselftest/20250115105211.390370-3-ps.report@gmx.net/

Regards,
Peter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-18 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-11 16:07 [PATCH 1/2] selftests/pid_namespace: fix building with clang-20 Dmitry Antipov
2025-03-11 16:07 ` [PATCH 2/2] selftests/pidfd: " Dmitry Antipov
2025-03-18 15:08 ` [PATCH 1/2] selftests/pid_namespace: " Peter Seiderer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox