From: Avinesh Kumar <akumar@suse.de>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] syscalls/pipe07: Rewrite the test using new LTP API
Date: Mon, 07 Aug 2023 15:20:34 +0530 [thread overview]
Message-ID: <3946361.0HB8mIXUQK@localhost> (raw)
In-Reply-To: <20230725094557.GA1629064@pevik>
Hi Petr,
Thank you for the review.
On Tuesday, July 25, 2023 3:15:57 PM IST Petr Vorel wrote:
> Hi Avinesh,
>
> generally LGTM, thank you.
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> BTW it's funny that when run with valgrind, it fails because valgrind opens
> some file descriptors:
>
> $ valgrind ./pipe07
> ...
> pipe07.c:45: TINFO: getdtablesize() = 1024
> pipe07.c:49: TINFO: open fds before pipe() calls: 10
> pipe07.c:54: TINFO: expected max fds to be opened by pipe(): 1014
> ==1629480== Warning: invalid file descriptor 1030 in syscall pipe2()
> pipe07.c:69: TPASS: errno == EMFILE (24)
> pipe07.c:70: TFAIL: exp_num_pipe_fds (1014) != num_pipe_fds (1020)
>
Ah yes, I also tried this. So valgrind is opening some file descriptors in the
process context, but I don't know if it's ok to ignore this behavior.
I'm taking care of other nit suggestions in revised patch.
> > +static void record_open_fds(void)
>
> nit: num_opened_fds is used only in setup(), I'd personally return int
> and store variable in setup().
>
> > {
> >
> > + DIR *dir;
> > + struct dirent *ent;
> > + int fd;
> >
> > - min = getdtablesize() - rec_fds_max;
> > + dir = SAFE_OPENDIR("/proc/self/fd");
>
> ...
>
> > +static void run(void)
> >
> > {
>
> ...
>
> > + do {
> > + TEST(pipe(fds));
> > + if (TST_RET != -1) {
>
> nit: wouldn't be safer to use: if (!TST_RET) (i.e. for TST_RET == 0)
> (we check that return on error is exactly -1, not > 0)
>
> Kind regards,
> Petr
>
> > + pipe_fds[num_pipe_fds++] = fds[0];
> > + pipe_fds[num_pipe_fds++] = fds[1];
> >
> > }
> >
> > + } while (TST_RET != -1);
>
> ...
--
Regards,
Avinesh
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-08-07 9:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-22 13:49 [LTP] [PATCH] syscalls/pipe07: Rewrite the test using new LTP API Avinesh Kumar
2023-07-25 9:45 ` Petr Vorel
2023-07-25 10:02 ` Cyril Hrubis
2023-08-07 9:50 ` Avinesh Kumar [this message]
2023-07-25 10:32 ` Cyril Hrubis
2023-08-07 9:52 ` Avinesh Kumar
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=3946361.0HB8mIXUQK@localhost \
--to=akumar@suse.de \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox