From patchwork Thu Aug 19 21:28:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 44718 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2E19739C0987 for ; Thu, 19 Aug 2021 21:28:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E19739C0987 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629408515; bh=8ntIFntxeQFPRUlk5krSgxh123og52/+XhvvS9UA2TQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Ww20gbN3MUWEpeCna/pCFv0gTyveleDzdDUfBZe2qC6TrAQE416X+cCl1AZXNl0o4 5UwJ47FvQbQp+rguqAQXNIByvQIixtMNYHzF4JAfzot1PaJhaP9QXKsTParyJDKnu1 EMW1btehE9iftN2fX2IPxL+CrSGNCsnZMOkBq42Q= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by sourceware.org (Postfix) with ESMTPS id 1DF47385C406 for ; Thu, 19 Aug 2021 21:28:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1DF47385C406 Received: by mail-pj1-x102a.google.com with SMTP id oa17so5939316pjb.1 for ; Thu, 19 Aug 2021 14:28:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8ntIFntxeQFPRUlk5krSgxh123og52/+XhvvS9UA2TQ=; b=YK/yof13D9DU8txpmUL/w/PlhzAub24MJk5OoADQkySyWyrG3EAlrRq3tlz0RuvAMs 1Z8fndbTf0mguDNZdlxkOuyO4blA7IgKgxCt888lI56jEFz3TFdTl4CvHTffWVmebk3W 5yaWD6KnnpVk3Lk/JZ431vwfSiJ3s+9vgipiQi7GwviQgnnqAh2Mna2dxDB/uPcp4L3T iXi3oFmUjAr9z6rEIXojoq0m8d7TsI9IZf1UOqbGfkTp//+3CicpeDYhbs2AHKx7e6Kr gwjZdKR6QKcw1G5dJ/gc78BApdnOQ7qLx0dsGGnQyhLJQSogcpcA3IOGsMPopl/CiqMq yCpw== X-Gm-Message-State: AOAM5302BqlrLUuH0TgixKG7NCHzQ0s/VW0VfDVj6oFe4G0/ahV3VIcg UF8D3ilGowBSxw2j1S2AkDTgxTJUSQk= X-Google-Smtp-Source: ABdhPJyMrDowt2kun3jNlGzLHJVMzXjrP2MtGMIoyp+uyfHHskmxgYQM4zhKzLNhMHVXfkGYdSU/Xw== X-Received: by 2002:a17:90a:1148:: with SMTP id d8mr880438pje.106.1629408491796; Thu, 19 Aug 2021 14:28:11 -0700 (PDT) Received: from localhost (g194.219-121-107.ppp.wakwak.ne.jp. [219.121.107.194]) by smtp.gmail.com with ESMTPSA id fh19sm9660090pjb.27.2021.08.19.14.28.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 14:28:11 -0700 (PDT) To: GLIBC patches Subject: [PATCH v2] time: Fix compile error in itimer test affecting hurd Date: Fri, 20 Aug 2021 06:28:00 +0900 Message-Id: <20210819212800.455725-1-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-Patchwork-Original-From: Stafford Horne via Libc-alpha From: Stafford Horne Reply-To: Stafford Horne Cc: Joseph Myers Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The recent change to use __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 to avoid doing 64-bit checks on some platforms broke the test for hurd where __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 is not defined. With error: tst-itimer.c: In function 'do_test': tst-itimer.c:103:11: error: '__KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64' undeclared (first use in this function) 103 | if (__KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tst-itimer.c:103:11: note: each undeclared identifier is reported only once for each function it appears in Define a support helper to detect when setitimer and getitimer support 64-bit time_t. Fixes commit 6e8a0aac2f ("time: Fix overflow itimer tests on 32-bit systems"). Cc: Adhemerval Zanella Cc: Joseph Myers --- Changes since v1: - Move macro to support helper function. support/support.h | 12 ++++++++++++ time/tst-itimer.c | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/support/support.h b/support/support.h index db264e3db7..7daa2c48c9 100644 --- a/support/support.h +++ b/support/support.h @@ -141,6 +141,18 @@ static __inline bool support_path_support_time64 (const char *path) 0x80000002ULL); } +/* Return true if the setitimer and getitimer syscalls support 64-bit time_t + values without resulting in overflow. This is not true on some linux systems + which have 64-bit time_t due to legacy kernel API's. */ +static __inline bool support_itimer_support_time64 (void) +{ +#ifdef __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 + return __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64; +#else + return (sizeof (__time_t) == 8); +#endif +} + /* Return true if stat supports nanoseconds resolution. */ extern bool support_stat_nanoseconds (const char *path); diff --git a/time/tst-itimer.c b/time/tst-itimer.c index bd7d7afe83..c6d623cb19 100644 --- a/time/tst-itimer.c +++ b/time/tst-itimer.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -100,7 +101,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 (__KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64) + if (support_itimer_support_time64()) { TEST_COMPARE (setitimer (timers[i], &it, NULL), 0); TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { 0 }, @@ -131,7 +132,7 @@ do_test (void) it.it_interval.tv_usec = 20; it.it_value.tv_sec = 30; it.it_value.tv_usec = 40; - if (__KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64) + if (support_itimer_support_time64()) { TEST_COMPARE (setitimer (timers[i], &it, NULL), 0);