[PATCH 2/2] selftests/pidfd: fix building with clang-20

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux