Seen while compiling tests,

```
$ make -C tools/testing/selftests/ TARGET=bpf 2>&1 | grep implicit

pidfd_fdinfo_test.c:230:13: warning: implicit declaration of function ‘mount’ 
[-Wimplicit-function-declaration]
pidfd_fdinfo_test.c:236:15: warning: implicit declaration of function 
‘umount2’; did you mean ‘SYS_umount2’? [-Wimplicit-function-declaration]
pid_max.c:42:15: warning: implicit declaration of function ‘mount’ 
[-Wimplicit-function-declaration]
pid_max.c:48:9: warning: implicit declaration of function ‘umount2’; did you 
mean ‘SYS_umount2’? [-Wimplicit-function-declaration]
```

Adding sys/mount in the header clears out the warnings

```
$ make -C tools/testing/selftests/ TARGET=bpf 2>&1 | grep implicit; echo $?
1
```

Reported-by: kernel test robot <l...@intel.com>
Closes: 
https://lore.kernel.org/oe-kbuild-all/202412222015.lmbh62zb-...@intel.com/
Cc: Christian Brauner <brau...@kernel.org>
Cs: Shuah Khan <sh...@kernel.org>
Signed-off-by: Ariel Otilibili <ariel.otilibili-ani...@eurecom.fr>
---
 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..96f274f0582b 100644
--- a/tools/testing/selftests/pid_namespace/pid_max.c
+++ b/tools/testing/selftests/pid_namespace/pid_max.c
@@ -10,6 +10,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <syscall.h>
+#include <sys/mount.h>
 #include <sys/wait.h>
 
 #include "../kselftest_harness.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 via email to