From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by sourceware.org (Postfix) with ESMTPS id 1683D39A002F for ; Wed, 9 Jun 2021 21:38:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1683D39A002F Received: by mail-pj1-x1033.google.com with SMTP id o17-20020a17090a9f91b029015cef5b3c50so2453348pjp.4 for ; Wed, 09 Jun 2021 14:38:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qFQUgKaTisRbuGEjxVaKSy6bDe4+FnYCJ6WbadcknII=; b=Lfrb/9LTbpZGMQ5ad7zU4gaCWoG+rEo9E+ft4r/j6JI2/JKfWma+TyDF/gCHzAHoBs c67zV04G46IQI3bYK4gsEsoMc1w9LM4WYiaTRjI3CA8EaVNcoUgj7VXgUIQ2MAje+obG 83OFuU5LTGko0PGIeEAZKLZb/IVNTGtZaF5VocdOxx1ASCXykobO1OlDLmL7j0wkJfQo SHz/fMS0WV96hICklT+V0PU8+EV+WygcNhO70YnGRHDnVBIhgM0L1Y6IK36yELYGRS0m Oa/R06GpJEU2wqLpkDqQkQ17hu9qf8grOFEJVJK8LHRhX0ZXUMngHAHmAA/34SeXACPa QGWw== X-Gm-Message-State: AOAM531Bnm+qyLeBibqZCbwDG+Mz3fkQ0f81cBaZ9e+qcir05QDB4b/z dEYFTrmfZd8MGx2BnGPT3jo= X-Google-Smtp-Source: ABdhPJz5xQIWXTL5GBQ7mEZdg0LCH1a3CSYsz7U429c8I+ix5tO8Au3HfnKb/WF4q7x9aRQ0F38JOg== X-Received: by 2002:a17:90b:120d:: with SMTP id gl13mr1688343pjb.72.1623274688056; Wed, 09 Jun 2021 14:38:08 -0700 (PDT) Received: from localhost (g151.115-65-219.ppp.wakwak.ne.jp. [115.65.219.151]) by smtp.gmail.com with ESMTPSA id u10sm412636pfh.123.2021.06.09.14.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 14:38:06 -0700 (PDT) Date: Thu, 10 Jun 2021 06:38:04 +0900 From: Stafford Horne To: Adhemerval Zanella Cc: GLIBC patches , Alistair Francis Subject: Re: [PATCH] time: Skip overflow itimer tests on 32-bit systems Message-ID: References: <20210607131851.4015661-1-shorne@gmail.com> <8ad55354-5d41-eaa4-6d6c-e650ea30d7cc@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8ad55354-5d41-eaa4-6d6c-e650ea30d7cc@linaro.org> X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 21:38:12 -0000 On Wed, Jun 09, 2021 at 10:50:23AM -0300, Adhemerval Zanella wrote: > > > 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); This looks good to me, I can update to this, test and resend the patch when I get some time. Probably later tonight. -Strafford