From: Florian Weimer <fweimer@redhat.com>
To: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
Andreas Schwab <schwab@suse.de>
Subject: Re: [PATCH v2 2/2] linux: always update select timeout (BZ #27706)
Date: Fri, 09 Apr 2021 14:26:13 +0200 [thread overview]
Message-ID: <87h7kfy78a.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20210409113639.1124756-2-adhemerval.zanella@linaro.org> (Adhemerval Zanella via Libc-alpha's message of "Fri, 9 Apr 2021 08:36:39 -0300")
* Adhemerval Zanella via Libc-alpha:
> diff --git a/misc/tst-select.c b/misc/tst-select.c
> index dc7717a7a6..9c817f4035 100644
> --- a/misc/tst-select.c
> +++ b/misc/tst-select.c
> @@ -23,6 +23,7 @@
> #include <support/timespec.h>
> #include <support/xunistd.h>
> #include <support/xtime.h>
> +#include <support/xsignal.h>
>
> struct child_args
> {
> @@ -30,6 +31,12 @@ struct child_args
> struct timeval tmo;
> };
>
> +static void
> +alarm_handler (int signum)
> +{
> + /* Do nothing. */
> +}
> +
> static void
> do_test_child (void *clousure)
> {
> @@ -59,6 +66,22 @@ do_test_child (void *clousure)
> xwrite (args->fds[1][1], "foo", 3);
> }
>
> +static void
> +do_test_child_alarm (void *clousure)
> +{
> + struct sigaction act = { .sa_handler = alarm_handler };
> + xsigaction (SIGALRM, &act, NULL);
> + alarm (1);
> +
> + struct timeval tv = { .tv_sec = 10, .tv_usec = 0 };
> + int r = select (0, NULL, NULL, NULL, &tv);
> + TEST_COMPARE (r, -1);
> + TEST_COMPARE (errno, EINTR);
> +
> + if (support_select_modify_timeout ())
> + TEST_VERIFY (tv.tv_sec < 10);
> +}
> +
> static int
> do_test (void)
> {
> @@ -98,6 +121,13 @@ do_test (void)
> xclose (args.fds[0][0]);
> xclose (args.fds[1][1]);
>
> + {
> + struct support_capture_subprocess result;
> + result = support_capture_subprocess (do_test_child_alarm, NULL);
> + support_capture_subprocess_check (&result, "tst-select-child", 0,
> + sc_allow_none);
> + }
> +
> {
> fd_set rfds;
> FD_ZERO (&rfds);
I thought a bit about how this would interact with SIGALRM in the test
suite, but this should be okay: the SIGALRM handler is in the parent
wrapper process, not in the child process, and in --direct mode (without
a wrapper), there is no timeout at all. So the test should be okay.
The actual code change looks okay to me too.
Thanks,
Florian
next prev parent reply other threads:[~2021-04-09 12:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 11:36 [PATCH v2 1/2] linux: Normalize and return timeout on select (BZ #27651) Adhemerval Zanella
2021-04-09 11:36 ` [PATCH v2 2/2] linux: always update select timeout (BZ #27706) Adhemerval Zanella
2021-04-09 12:26 ` Florian Weimer [this message]
2021-04-09 12:38 ` [PATCH v2 1/2] linux: Normalize and return timeout on select (BZ #27651) Florian Weimer
2021-04-09 12:46 ` Adhemerval Zanella
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=87h7kfy78a.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
--cc=schwab@suse.de \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).