From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) by sourceware.org (Postfix) with ESMTPS id 0296B3892460 for ; Wed, 9 Jun 2021 13:50:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0296B3892460 Received: by mail-qv1-xf29.google.com with SMTP id g12so12771980qvx.12 for ; Wed, 09 Jun 2021 06:50:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Hji5Jrn3HiFNvj+GKuIc8uJQWX9i8vH3aQYAEqysPq8=; b=c/EtNX5SgQnyGvuNjHopbMmYGgbY9zIFvoU/hZYWsM2D3kCWsHva8nGbqIL5BKetsu i7WS9EpjnLaWAGA7+dHKNiDdBh2wF0hyqrgMJ/OgLuYaZNyH/pYDstna3jNphLg+uYVo g7P2F+4UCoJRfoj0F4iNK1GqXNG81b20BpPhH0rZxKIdHUhk5Zwr9r/29iKtHfgbrjkU 5Fgehr56yLYsqL+DmASexWh/fY9dEHLceMDL1yLj93HREP5AfbutVG45Gt2bMp5MdJzQ EPYB+BdbaGV2Y3TwuESRR4gZCIfcmOJynve08MugIF7bVx9NsEAHZQl79ds4ZWa2gDTK FSTg== X-Gm-Message-State: AOAM531t1Tt6Pep0WWeTs6agnD7hSaPjH7E9dl1EVxC5R7nBTnVY9dST ka+7w1z16V/LZWQ69YrheEmMLQ== X-Google-Smtp-Source: ABdhPJyU5oppOWo+OD1I1zOaKpRTbxdlgajtJVk1wb/GfvTCkZS5N7y0AyjPgVluS9O29fYyIghwhw== X-Received: by 2002:ad4:566f:: with SMTP id bm15mr68966qvb.54.1623246626608; Wed, 09 Jun 2021 06:50:26 -0700 (PDT) Received: from [192.168.1.4] ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id 200sm76706qkk.12.2021.06.09.06.50.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Jun 2021 06:50:26 -0700 (PDT) Subject: Re: [PATCH] time: Skip overflow itimer tests on 32-bit systems To: Stafford Horne , GLIBC patches Cc: Alistair Francis References: <20210607131851.4015661-1-shorne@gmail.com> From: Adhemerval Zanella Message-ID: <8ad55354-5d41-eaa4-6d6c-e650ea30d7cc@linaro.org> Date: Wed, 9 Jun 2021 10:50:23 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210607131851.4015661-1-shorne@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, 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: Wed, 09 Jun 2021 13:50:28 -0000 On 07/06/2021 10:18, Stafford Horne wrote: > On the port of OpenRISC I am working on and it appears the rv32 port > we have sets __TIMESIZE == 64 && __WORDSIZE == 32. This causes the > size of time_t to be 8 bytes, but the tv_sec in the kernel is still 32-bit > causing truncation. > > The truncations are unavoidable on these systems so skip the > testing/failures by guarding with __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64. Sigh, I was hoping that we won't need to handle this situation (glibc support only 64-bit time_t, but kernel still providing some 32-bit syscall). > --- > > I am open to other suggestions, this seemed the most correct to me. > > Cc: Adhemerval Zanella > Cc: Alistair Francis > > time/tst-itimer.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/time/tst-itimer.c b/time/tst-itimer.c > index 929c2b74c7..0c99d46d7e 100644 > --- a/time/tst-itimer.c > +++ b/time/tst-itimer.c > @@ -89,6 +89,7 @@ do_test (void) > TEST_COMPARE (it.it_interval.tv_sec, it_old.it_interval.tv_sec); > TEST_COMPARE (it.it_interval.tv_usec, it_old.it_interval.tv_usec); > > +#if __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 > if (sizeof (time_t) == 4) > continue; > > @@ -146,6 +147,7 @@ do_test (void) > TEST_COMPARE (setitimer (timers[i], &it, NULL), -1); > TEST_COMPARE (errno, EOVERFLOW); > } > +#endif > } > > { > Instead of disabling, I think it would be better to use __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 instead of __time_t sizeof (so we can still tests the EOVERFLOW): diff --git a/time/tst-itimer.c b/time/tst-itimer.c index 929c2b74c7..bd7d7afe83 100644 --- a/time/tst-itimer.c +++ b/time/tst-itimer.c @@ -100,7 +100,7 @@ do_test (void) /* Linux does not provide 64 bit time_t support for getitimer and setitimer on architectures with 32 bit time_t support. */ - if (sizeof (__time_t) == 8) + if (__KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64) { TEST_COMPARE (setitimer (timers[i], &it, NULL), 0); TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { 0 }, @@ -131,7 +131,7 @@ do_test (void) it.it_interval.tv_usec = 20; it.it_value.tv_sec = 30; it.it_value.tv_usec = 40; - if (sizeof (__time_t) == 8) + if (__KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64) { TEST_COMPARE (setitimer (timers[i], &it, NULL), 0);