linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] selftests/cgroup: Fix build on older distros
@ 2020-11-06  7:40 Sachin Sant
  2020-11-10 22:15 ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Sachin Sant @ 2020-11-06  7:40 UTC (permalink / raw)
  To: Michael Ellerman, linux-kselftest, skhan
  Cc: Sachin Sant, christian, linux-kernel, linux-kselftest, keescook

On older distros struct clone_args does not have a cgroup member,
leading to build errors:

 cgroup_util.c: In function 'clone_into_cgroup':
 cgroup_util.c:343:4: error: 'struct clone_args' has no member named 'cgroup'
 cgroup_util.c:346:33: error: invalid application of 'sizeof' to incomplete
  type 'struct clone_args'

But the selftests already have a locally defined version of the
structure which is up to date, called __clone_args.

So use __clone_args which fixes the error.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sachin Sant <sachinp@linux.vnet.ibm.com>>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
---

V2: Replace all instances of clone_args by __clone_args
---

diff --git a/a/tools/testing/selftests/cgroup/cgroup_util.c b/b/tools/testing/selftests/cgroup/cgroup_util.c
index 05853b0..0270146 100644
--- a/a/tools/testing/selftests/cgroup/cgroup_util.c
+++ b/b/tools/testing/selftests/cgroup/cgroup_util.c
@@ -337,13 +337,13 @@ pid_t clone_into_cgroup(int cgroup_fd)
 #ifdef CLONE_ARGS_SIZE_VER2
 	pid_t pid;
 
-	struct clone_args args = {
+	struct __clone_args args = {
 		.flags = CLONE_INTO_CGROUP,
 		.exit_signal = SIGCHLD,
 		.cgroup = cgroup_fd,
 	};
 
-	pid = sys_clone3(&args, sizeof(struct clone_args));
+	pid = sys_clone3(&args, sizeof(struct __clone_args));
 	/*
 	 * Verify that this is a genuine test failure:
 	 * ENOSYS -> clone3() not available

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

* Re: [PATCH V2] selftests/cgroup: Fix build on older distros
  2020-11-06  7:40 [PATCH V2] selftests/cgroup: Fix build on older distros Sachin Sant
@ 2020-11-10 22:15 ` Shuah Khan
  2020-11-11  6:11   ` Sachin Sant
  0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2020-11-10 22:15 UTC (permalink / raw)
  To: Sachin Sant, Michael Ellerman, linux-kselftest
  Cc: christian, linux-kernel, keescook, Shuah Khan

On 11/6/20 12:40 AM, Sachin Sant wrote:
> On older distros struct clone_args does not have a cgroup member,
> leading to build errors:
> 
>   cgroup_util.c: In function 'clone_into_cgroup':
>   cgroup_util.c:343:4: error: 'struct clone_args' has no member named 'cgroup'
>   cgroup_util.c:346:33: error: invalid application of 'sizeof' to incomplete
>    type 'struct clone_args'
> 
> But the selftests already have a locally defined version of the
> structure which is up to date, called __clone_args.
> 
> So use __clone_args which fixes the error.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Sachin Sant <sachinp@linux.vnet.ibm.com>>
> Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
> ---
> 
> V2: Replace all instances of clone_args by __clone_args
> ---
> 
> diff --git a/a/tools/testing/selftests/cgroup/cgroup_util.c b/b/tools/testing/selftests/cgroup/cgroup_util.c
> index 05853b0..0270146 100644
> --- a/a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -337,13 +337,13 @@ pid_t clone_into_cgroup(int cgroup_fd)
>   #ifdef CLONE_ARGS_SIZE_VER2
>   	pid_t pid;
>   
> -	struct clone_args args = {
> +	struct __clone_args args = {
>   		.flags = CLONE_INTO_CGROUP,
>   		.exit_signal = SIGCHLD,
>   		.cgroup = cgroup_fd,
>   	};
>   
> -	pid = sys_clone3(&args, sizeof(struct clone_args));
> +	pid = sys_clone3(&args, sizeof(struct __clone_args));
>   	/*
>   	 * Verify that this is a genuine test failure:
>   	 * ENOSYS -> clone3() not available
> 

Not sure how you generated the patch. I had to use git am -p2

Applied to linux-kselftest next - please make sure to generate from
top level.

thanks,
-- Shuah


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

* Re: [PATCH V2] selftests/cgroup: Fix build on older distros
  2020-11-10 22:15 ` Shuah Khan
@ 2020-11-11  6:11   ` Sachin Sant
  0 siblings, 0 replies; 3+ messages in thread
From: Sachin Sant @ 2020-11-11  6:11 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Michael Ellerman, linux-kselftest, christian, linux-kernel, keescook



> On 11-Nov-2020, at 3:45 AM, Shuah Khan <skhan@linuxfoundation.org> wrote:
> 
> On 11/6/20 12:40 AM, Sachin Sant wrote:
>> ---
>> V2: Replace all instances of clone_args by __clone_args
>> ---
>> diff --git a/a/tools/testing/selftests/cgroup/cgroup_util.c b/b/tools/testing/selftests/cgroup/cgroup_util.c
>> index 05853b0..0270146 100644
>> --- a/a/tools/testing/selftests/cgroup/cgroup_util.c
>> +++ b/b/tools/testing/selftests/cgroup/cgroup_util.c
> 
> Not sure how you generated the patch. I had to use git am -p2
> 
Sorry about that. Not sure what happened. Thanks.

-Sachin

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

end of thread, other threads:[~2020-11-11  6:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06  7:40 [PATCH V2] selftests/cgroup: Fix build on older distros Sachin Sant
2020-11-10 22:15 ` Shuah Khan
2020-11-11  6:11   ` Sachin Sant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).