From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/2] syscalls/pidfd_open01.c: Add check for close-on-exec flag
Date: Wed, 13 May 2020 12:30:32 +0200 [thread overview]
Message-ID: <20200513103032.GA18763@dell5510> (raw)
In-Reply-To: <5EBBCA12.5020901@cn.fujitsu.com>
Hi Yang,
> Thanks a lot for your quick reply.
Thanks for a patience (we're not working just on LTP unfortunately).
> Resetting errno may not necessary because errno will be set again when
> fd == -1.
Agree, I'm just careful, thus asking :).
> > > 2) tst_syscall() is enough to check the support of pidfd_open() and I
> > > don't want to define check function as fsopen_supported_by_kernel()
> > > does.
> > > Do you think so?
> > > BTW:
> > > I don't like the implementation of fsopen_supported_by_kernel():
> > > a) syscall()/tst_syscall() is enough to check the support of
> > > pidfd_open(2) and 'tst_kvercmp(5, 2, 0))< 0' will skip the check if
> > +1 for tst_syscall()
> > > a kernel on distribution is newer than v5.2 but drop the support of
> > > pidfd_open(2) on purpose.
> > "drop support of pidfd_open(2) on purpose": would anybody has a reason to do
> > that?
> As my pervious mail said, It is just a possible situation? for example:
> Upstream kernel introduces btrfs filesystem long long ago but the
> kernel of RHEL8 drops btrfs filesystem because of some reasons.
I guess filesystem changes are the most frequent. But as I said, I wouldn't mind
this implementation:
void fsopen_supported_by_kernel(void)
{
TEST(tst_syscall(__NR_fsopen, NULL, 0));
if (TST_RET != -1)
SAFE_CLOSE(TST_RET);
}
> It is just a reason used to explain why I want to drop the kernel version
> check.
...
> > How about to call the function pidfd_open_supported_by_kernel()?
> OK
> > Than you can remove the comment (which BTW should use C style /* */).
> OK
> > And IMHO you don't have to assign pidfd to -1.
> In pidfd_open_supported_by_kernel(), do you want to drop 'pidfd = -1'
> directly or drop 'pidfd = -1' by using TEST()?
I meant (as it's always assigned by the call, it's just a nit.):
-int pidfd = -1;
+int pidfd;
Kind regards,
Petr
next prev parent reply other threads:[~2020-05-13 10:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 1:26 [LTP] [PATCH v2 1/2] syscalls/pidfd_open01.c: Add check for close-on-exec flag Xiao Yang
2020-05-13 1:26 ` [LTP] [PATCH v2 2/2] syscalls/pidfd_open*.c: Drop .min_kver flag Xiao Yang
2020-05-13 5:55 ` Viresh Kumar
2020-05-13 6:03 ` Xiao Yang
2020-05-13 6:13 ` Viresh Kumar
2020-05-13 6:31 ` Xiao Yang
2020-05-13 6:39 ` Viresh Kumar
2020-05-13 2:28 ` [LTP] [PATCH v2 1/2] syscalls/pidfd_open01.c: Add check for close-on-exec flag Xiao Yang
2020-05-13 9:20 ` Petr Vorel
2020-05-13 10:21 ` Xiao Yang
2020-05-13 10:30 ` Petr Vorel [this message]
2020-05-14 7:37 ` Petr Vorel
2020-05-14 9:43 ` Xiao Yang
2020-05-14 14:14 ` Petr Vorel
2020-05-14 14:27 ` Xiao Yang
2020-05-13 12:34 ` Cyril Hrubis
2020-05-13 13:12 ` Xiao Yang
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=20200513103032.GA18763@dell5510 \
--to=pvorel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox