From: Avinesh Kumar <akumar@suse.de>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/3] getpgid01.c: Rewrite using new LTP API
Date: Wed, 12 Apr 2023 14:22:44 +0530 [thread overview]
Message-ID: <1809432.yOLanILp2W@localhost> (raw)
In-Reply-To: <ZC1ToUKUUSG7s6S/@yuki>
Hi Cyril,
Thank you for the review.
On Wednesday, April 5, 2023 4:25:29 PM IST you wrote:
> Hi!
> > + pid_1 = SAFE_FORK();
> > + if (!pid_1) {
> > + child_pid = getpid();
> > + ppid = getppid();
> >
> > - if ((pgid_0 = FORK_OR_VFORK()) == -1)
> > - tst_brkm(TBROK, cleanup, "fork failed");
> > - if (pgid_0 > 0) {
> > - while ((pgid_0 = wait(&ex_stat)) != -1) ;
> > + tst_res(TINFO, "getpid() in child = %d", child_pid);
> > + tst_res(TINFO, "getppid() in child = %d", ppid);
> > + tst_res(TINFO, "Running getpgid() in child");
> >
> > - if (WEXITSTATUS(ex_stat) == 0)
> > - tst_resm(TPASS, "%s PASSED", TCID);
> > - else
> > - tst_resm(TFAIL, "%s FAILED", TCID);
> > + TST_EXP_POSITIVE(getpgid(0));
> > + TST_EXP_EQ_LI(TST_RET, ppid);
>
> I do not think that this is correct, the previous code compared the
> return value from getpgid(0) against the rest, not parent pid.
I think I wrongly assumed the ppid to be pgid of itself and children processes.
Thanks for pointing it point.
>
> I guess that the best solution here would be to call getgid() in the
I guess you meant getpgid() here?
> parent and save that to a variable and use that for the comparsion in
> the child.
>
>
Regards,
Avinesh
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-04-12 8:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 5:44 [LTP] [PATCH 1/3] getpgid01.c: Rewrite using new LTP API Avinesh Kumar
2023-04-04 5:44 ` [LTP] [PATCH 2/3] getpgid02.c: " Avinesh Kumar
2023-04-11 14:52 ` Cyril Hrubis
2023-04-04 5:44 ` [LTP] [PATCH 3/3] getpgrp01: Convert to " Avinesh Kumar
2023-04-05 10:55 ` [LTP] [PATCH 1/3] getpgid01.c: Rewrite using " Cyril Hrubis
2023-04-12 8:52 ` Avinesh Kumar [this message]
2023-04-13 8:40 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1809432.yOLanILp2W@localhost \
--to=akumar@suse.de \
--cc=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.