[LTP] [PATCH v2 8/8] Rewrite userns08.c using new LTP API
Andrea Cervesato
andrea.cervesato@suse.com
Fri Mar 25 09:58:34 CET 2022
Hi Petr,
I think this patch can be avoided at this point
Andrea
On 3/25/22 08:18, Petr Vorel wrote:
> Hi Andrea,
>
> [Cc Richie]
>
> This subject: "Rewrite userns08.c using new LTP API" is misleading,
> userns08.c was already using new API.
>
> You're:
> * s/tst_res/tst_brk/ (that would deserve explanation why)
> * removing tst_reap_children()
> * changing formatting (some of them create too long lines)
>
> ...
>> static pid_t clone_newuser(void)
>> {
>> - const struct tst_clone_args cargs = {
>> - CLONE_NEWUSER,
>> - SIGCHLD
>> - };
>> + const struct tst_clone_args cargs = { CLONE_NEWUSER, SIGCHLD };
>> return SAFE_CLONE(&cargs);
>> }
>> -static void write_mapping(const pid_t proc_in_ns,
>> - const char *const id_mapping)
>> +static void write_mapping(const pid_t proc_in_ns, const char *const id_mapping)
>> {
>> char proc_path[PATH_MAX];
>> int proc_dir;
>> @@ -61,11 +58,11 @@ static void write_mapping(const pid_t proc_in_ns,
>> static void ns_level2(void)
>> {
>> if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0))
>> - tst_res(TINFO | TERRNO, "Failed to set dumpable flag");
>> + tst_brk(TBROK | TTERRNO, "Failed to set dumpable flag");
> Not sure which one is correct (whether tst_res or tst_brk).
> But TTERRNO is obviously wrong, that's for using TEST(). Here should remain
> TERRNO.
>
>> +
>> TST_CHECKPOINT_WAKE_AND_WAIT(1);
>> - TST_EXP_FAIL(open("restricted", O_WRONLY), EACCES,
>> - "Denied write access to ./restricted");
>> + TST_EXP_FAIL(open("restricted", O_WRONLY), EACCES, "Denied write access to ./restricted");
> I'd keep this one.
>
>> exit(0);
>> }
>> @@ -89,7 +86,6 @@ static void ns_level1(void)
>> write_mapping(level2_proc, map_over_5);
>> TST_CHECKPOINT_WAKE(1);
>> - tst_reap_children();
> Well, test works without it, but not really sure if it can be removed.
>
> Kind regards,
> Petr
>
>> exit(0);
>> }
>> @@ -111,7 +107,6 @@ static void run(void)
>> write_mapping(level1_proc, "0 100000 1000");
>> TST_CHECKPOINT_WAKE(0);
>> - tst_reap_children();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20220325/9b5652eb/attachment-0001.htm>
More information about the ltp
mailing list