diff mbox series

selftests/vdso: Add linux/sched.h to fix CLONE_NEWTIME build error

Message ID 20241002152849.111841-1-surajsonawane0215@gmail.com (mailing list archive)
State New
Headers show
Series selftests/vdso: Add linux/sched.h to fix CLONE_NEWTIME build error | expand

Commit Message

SurajSonawane2415 Oct. 2, 2024, 3:28 p.m. UTC
Fix build error in vdso_test_getrandom.c due to missing CLONE_NEWTIME.
Include linux/sched.h to define CLONE_NEWTIME.
Ensure successful compilation by resolving the missing header issue.

Signed-off-by: SurajSonawane2415 <surajsonawane0215@gmail.com>
---
 tools/testing/selftests/vDSO/vdso_test_getrandom.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Shuah Khan Oct. 2, 2024, 10:39 p.m. UTC | #1
On 10/2/24 09:28, SurajSonawane2415 wrote:
> Fix build error in vdso_test_getrandom.c due to missing CLONE_NEWTIME.
> Include linux/sched.h to define CLONE_NEWTIME.
> Ensure successful compilation by resolving the missing header issue.
> 

Did you run "make headers" before building this test? It builds
just fine for me on my system.

+ Adding Jason Donenfeld

> Signed-off-by: SurajSonawane2415 <surajsonawane0215@gmail.com>
> ---
>   tools/testing/selftests/vDSO/vdso_test_getrandom.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
> index 72a1d9b43..3f2a4dbf8 100644
> --- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c
> +++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
> @@ -22,6 +22,7 @@
>   #include <linux/random.h>
>   #include <linux/compiler.h>
>   #include <linux/ptrace.h>
> +#include <linux/sched.h>
>   
>   #include "../kselftest.h"
>   #include "parse_vdso.h"

thanks,
-- Shuah
Jason A. Donenfeld Oct. 2, 2024, 10:51 p.m. UTC | #2
Wasn't this already submitted and commented on?

https://lore.kernel.org/all/20240919111841.20226-1-liaoyu15@huawei.com/
SurajSonawane2415 Oct. 3, 2024, 11:52 a.m. UTC | #3
Yes, I ran it but faced an issue. After reading comments on a similar patch shared by Jason A. 
Donenfeld, I realized that my environment is Ubuntu 22.04 (Linux 5.15 + glibc 2.35). 
After upgrading to a newer version of glibc, the issue seems to be fixed. 
I think including <sched.h> might not be needed. I would really appreciate your advice on how to handle this.
Shuah Khan Oct. 3, 2024, 10:26 p.m. UTC | #4
On 10/2/24 16:51, Jason A. Donenfeld wrote:
> Wasn't this already submitted and commented on?
> 
> https://lore.kernel.org/all/20240919111841.20226-1-liaoyu15@huawei.com/

Thank you Jason. Yes we reviewed this - I asked Yu Liao to send
me v2 since the define is coming in from pthread.h indirectly.

Suraj, Thank for finding and fixing the problem. However Yu Liao sent
in patch for this before you did. We will take that patch.

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
index 72a1d9b43..3f2a4dbf8 100644
--- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c
+++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
@@ -22,6 +22,7 @@ 
 #include <linux/random.h>
 #include <linux/compiler.h>
 #include <linux/ptrace.h>
+#include <linux/sched.h>
 
 #include "../kselftest.h"
 #include "parse_vdso.h"