From: Petr Vorel <pvorel@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 1/2] epoll_pwait: Refactor timeout to struct timespec
Date: Wed, 4 Jun 2025 08:35:21 +0200 [thread overview]
Message-ID: <20250604063521.GA1094733@pevik> (raw)
In-Reply-To: <20250603152253.214656-2-mdoucha@suse.cz>
Hi Martin,
> Support higher precision timeout in do_epoll_pwait() by passing struct
> timespec instead of int value in milliseconds. Only one test actually
> uses the parameter.
Ah, you mean epoll_pwait03.c.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
...
> +++ b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait_var.h
> @@ -14,22 +14,22 @@
> #define NSEC_PER_MSEC (1000000L)
> static int do_epoll_pwait(int epfd, struct epoll_event *events, int
> - maxevents, int timeout, const sigset_t *sigmask)
> + maxevents, struct timespec *timeout, const sigset_t *sigmask)
> {
> - if (tst_variant == 0)
> - return epoll_pwait(epfd, events, maxevents, timeout, sigmask);
> + if (tst_variant == 0) {
> + int timeout_ms = -1;
very nit: I would reverse the condition to save indent for tst_variant == 0:
if (tst_variant != 0)
return epoll_pwait2(epfd, events, maxevents, timeout, sigmask);
...
Kind regards,
Petr
> - struct timespec ts;
> + if (timeout) {
> + timeout_ms = timeout->tv_sec * MSEC_PER_SEC;
> + timeout_ms += (timeout->tv_nsec + NSEC_PER_MSEC - 1) /
> + NSEC_PER_MSEC;
> + }
> - if (timeout < 0) {
> - return epoll_pwait2(epfd, events, maxevents, NULL, sigmask);
> - } else {
> - ts.tv_sec = timeout / MSEC_PER_SEC;
> - ts.tv_nsec = NSEC_PER_MSEC * (timeout % MSEC_PER_SEC);
> + return epoll_pwait(epfd, events, maxevents, timeout_ms,
> + sigmask);
> }
> - return epoll_pwait2(epfd, events, maxevents, &ts, sigmask);
> -
> + return epoll_pwait2(epfd, events, maxevents, timeout, sigmask);
> }
> static void epoll_pwait_init(void)
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-06-04 6:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 15:22 [LTP] [PATCH v2 0/2] epoll_pwait2() timeout regression test Martin Doucha
2025-06-03 15:22 ` [LTP] [PATCH v2 1/2] epoll_pwait: Refactor timeout to struct timespec Martin Doucha
2025-06-04 6:35 ` Petr Vorel [this message]
2025-06-04 12:10 ` Martin Doucha
2025-06-05 6:28 ` Petr Vorel
2025-06-04 7:01 ` Andrea Cervesato via ltp
2025-06-03 15:22 ` [LTP] [PATCH v2 2/2] Add regression test for epoll_pwait2() timeout Martin Doucha
2025-06-04 7:01 ` Andrea Cervesato via ltp
2025-06-04 7:29 ` Petr Vorel
2025-06-04 7:34 ` [LTP] [PATCH v2 0/2] epoll_pwait2() timeout regression test Petr Vorel
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=20250604063521.GA1094733@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
--cc=mdoucha@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