Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] selftests: pid_namespace and pidfd missing include
@ 2025-01-28 17:04 Alessandro Zanni
  2025-02-13  0:24 ` Alessandro Zanni
  0 siblings, 1 reply; 4+ messages in thread
From: Alessandro Zanni @ 2025-01-28 17:04 UTC (permalink / raw)
  To: brauner, shuah; +Cc: Alessandro Zanni, linux-kernel, linux-kselftest

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


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

* Re: [PATCH] selftests: pid_namespace and pidfd missing include
  2025-01-28 17:04 [PATCH] selftests: pid_namespace and pidfd missing include Alessandro Zanni
@ 2025-02-13  0:24 ` Alessandro Zanni
  2025-02-19  0:26   ` Shuah Khan
  0 siblings, 1 reply; 4+ messages in thread
From: Alessandro Zanni @ 2025-02-13  0:24 UTC (permalink / raw)
  To: brauner, shuah; +Cc: linux-kernel, linux-kselftest

> 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

Hello,

I'm reaching out to know if you have any comments or
feedbacks about this patch.

Thanks,
Alessandro

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

* Re: [PATCH] selftests: pid_namespace and pidfd missing include
  2025-02-13  0:24 ` Alessandro Zanni
@ 2025-02-19  0:26   ` Shuah Khan
  2025-02-20 16:42     ` Peter Seiderer
  0 siblings, 1 reply; 4+ messages in thread
From: Shuah Khan @ 2025-02-19  0:26 UTC (permalink / raw)
  To: Alessandro Zanni, brauner, shuah
  Cc: linux-kernel, linux-kselftest, Shuah Khan

On 2/12/25 17:24, Alessandro Zanni wrote:
>> 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
> 
> Hello,
> 
> I'm reaching out to know if you have any comments or
> feedbacks about this patch.
> 

Christian, would you like me to pick this patch up?

thanks,
-- Shuah

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

* Re: [PATCH] selftests: pid_namespace and pidfd missing include
  2025-02-19  0:26   ` Shuah Khan
@ 2025-02-20 16:42     ` Peter Seiderer
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Seiderer @ 2025-02-20 16:42 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Alessandro Zanni, brauner, shuah, linux-kernel, linux-kselftest

On Tue, 18 Feb 2025 17:26:19 -0700, Shuah Khan <skhan@linuxfoundation.org> wrote:

> On 2/12/25 17:24, Alessandro Zanni wrote:
> >> 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  

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

~                                                                               
~                     
> > 
> > Hello,
> > 
> > I'm reaching out to know if you have any comments or
> > feedbacks about this patch.
> >   
> 
> Christian, would you like me to pick this patch up?
> 
> thanks,
> -- Shuah


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

end of thread, other threads:[~2025-02-20 16:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-28 17:04 [PATCH] selftests: pid_namespace and pidfd missing include Alessandro Zanni
2025-02-13  0:24 ` Alessandro Zanni
2025-02-19  0:26   ` Shuah Khan
2025-02-20 16:42     ` Peter Seiderer

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