[LTP] [PATCH v4 2/3] tst_cgroup: Add safe_cg_open and safe_cg_fchown functions

xuyang2018.jy@fujitsu.com xuyang2018.jy@fujitsu.com
Fri Aug 26 08:33:31 CEST 2022


Hi Richard

> Hello,
> 
> Yang Xu <xuyang2018.jy@fujitsu.com> writes:
> 
>> safe_cg_open is used to open the sub controller's file ie cgroup.procs
>> and returns the opened fd number. The opened fd array is stored in
>> fds argument.
>>
>> safe_cg_fchown is used to use fchownat to change file's uid and gid.
>>
>> Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
>> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>> ---
>>   include/tst_cgroup.h | 21 +++++++++++++++++++++
>>   lib/tst_cgroup.c     | 41 +++++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 62 insertions(+)
>>
>> diff --git a/include/tst_cgroup.h b/include/tst_cgroup.h
>> index d06847cc6..db959380f 100644
>> --- a/include/tst_cgroup.h
>> +++ b/include/tst_cgroup.h
>> @@ -89,6 +89,9 @@ enum tst_cg_ver {
>>   	TST_CG_V2 = 2,
>>   };
>>   
>> +/* This value is equal to ROOTS_MAX in tst_cgroup.c. */
>> +#define TST_CG_ROOTS_MAX 32
> 
> Thanks, pushed with small change to this comment. Because
> TST_CG_ROOTS_MAX is actually greater than ROOTS_MAX.

Oh, yes, good catch.

Best Regards
Yang Xu
> 


More information about the ltp mailing list