Re: [PATCH 1/2] selftests/pid_namespace: fix building with clang-20

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

 



Hello Dmitry,

On Tue, 11 Mar 2025 19:07:05 +0300, Dmitry Antipov <dmantipov@xxxxxxxxx> 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@xxxxxxxxx>
> ---
>  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@xxxxxxx/
        https://lore.kernel.org/linux-kselftest/20250115105211.390370-2-ps.report@xxxxxxx/
	https://lore.kernel.org/linux-kselftest/20250115105211.390370-3-ps.report@xxxxxxx/

Regards,
Peter





[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