From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 73543388A43B for ; Fri, 9 Apr 2021 12:26:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 73543388A43B Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-jXLyL_DjPomX7iBbQ3K3Dw-1; Fri, 09 Apr 2021 08:26:06 -0400 X-MC-Unique: jXLyL_DjPomX7iBbQ3K3Dw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C779D18B9F42; Fri, 9 Apr 2021 12:26:05 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-70.ams2.redhat.com [10.36.112.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B29A15C1A1; Fri, 9 Apr 2021 12:26:04 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella via Libc-alpha Cc: Adhemerval Zanella , Andreas Schwab Subject: Re: [PATCH v2 2/2] linux: always update select timeout (BZ #27706) References: <20210409113639.1124756-1-adhemerval.zanella@linaro.org> <20210409113639.1124756-2-adhemerval.zanella@linaro.org> Date: Fri, 09 Apr 2021 14:26:13 +0200 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") Message-ID: <87h7kfy78a.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 12:26:09 -0000 * 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 > #include > #include > +#include > > 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