From: Petr Vorel <pvorel@suse.cz>
To: Avinesh Kumar <akumar@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] syscalls/pipe07: Rewrite the test using new LTP API
Date: Tue, 25 Jul 2023 11:45:57 +0200 [thread overview]
Message-ID: <20230725094557.GA1629064@pevik> (raw)
In-Reply-To: <20230722134949.15684-1-akumar@suse.de>
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)
> +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);
...
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-07-25 9:46 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 [this message]
2023-07-25 10:02 ` Cyril Hrubis
2023-08-07 9:50 ` Avinesh Kumar
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=20230725094557.GA1629064@pevik \
--to=pvorel@suse.cz \
--cc=akumar@suse.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox