From patchwork Thu Aug 19 14:58:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 44715 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 4A43C3851C2A for ; Thu, 19 Aug 2021 14:59:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A43C3851C2A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629385165; bh=iQBiAyquhVP5OcLxiD1TAoSaJGVAQsydP3hHRHYzVkk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=EE1qgWssv4LRLHQDQWav2HJCAIH0HwIjjsbpK3oib+RrPXwo2l74PZQBw1Gkh/bGl tLnZHLLkbZfc7cwlYub+t3h15PNof9mHhnIG1IlyoutL9fD8thVkofTy8G33OCOydX T34PBuZ9LUJL2D0vUWAgeHsUiA9Q0puo+JKQEYnE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id A3C6A385840A for ; Thu, 19 Aug 2021 14:59:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A3C6A385840A Received: by mail-pj1-x102e.google.com with SMTP id om1-20020a17090b3a8100b0017941c44ce4so11505867pjb.3 for ; Thu, 19 Aug 2021 07:59:03 -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=iQBiAyquhVP5OcLxiD1TAoSaJGVAQsydP3hHRHYzVkk=; b=SmIdGf+zb0tfn4ilD5cH7J9gnSqfyJu2fObLwvKQ2bKsvu/lapI2CwYSTOKcbRDbCi p/qJ4up8QgfL/bhhwPkhLSW0pC7/w7p8WZ3k2CX6g9Xntj6w3J85Spv7OU23q+nAACfM QrN7l0D28syk/yLwpPTGEuppIm3feu7RAXZI+y1SvdA0cvZQ95EeiqCAwJETunuu1KcG tr5P5hSwQ7HBC6H3izyMvnDHBUJcZI1R+Q9YaFN6fQaNg1CmujIdMcjPXD69lhN6wu3B IlXfh05Nywai6q30yZvAfet1q8wDX+KRpNsixh80NbKpmpINh9VuGOg1qhw395IDDCAH RxdQ== X-Gm-Message-State: AOAM531kl5JgKRrs4ARe9cmZ54WfqdtWbc07/PvPEsiQN7SoJLdgHDaD SNcVwtTA7dSJAvBV8rxwLGnxD57IyFI= X-Google-Smtp-Source: ABdhPJzeS7UF3H0v7skHI78e+CvaKqtC3DjJihGQOMGyMvfDOkvdB4WIBhFMSXLqHpOwaxZF8iGfrA== X-Received: by 2002:a17:902:8348:b029:12b:b2a0:941b with SMTP id z8-20020a1709028348b029012bb2a0941bmr12206838pln.62.1629385142323; Thu, 19 Aug 2021 07:59:02 -0700 (PDT) Received: from localhost (g194.219-121-107.ppp.wakwak.ne.jp. [219.121.107.194]) by smtp.gmail.com with ESMTPSA id x4sm3741454pfc.191.2021.08.19.07.59.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 07:59:01 -0700 (PDT) To: GLIBC patches Subject: [PATCH] time: Fix compile error in itimer test affecting hurd Date: Thu, 19 Aug 2021 23:58:53 +0900 Message-Id: <20210819145853.63520-1-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.2 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 new macro that works for both hurd and linux 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 --- Hi Joseph, I know you mentioned defining a new macro, I was not sure if you meant in the test or globally. I opted to add this to the test as I don't see a good reason to add the macro to hurd which is only needed for this test. I build tested this on i686-gnu and ran my tests on or1k and it does work. -Stafford time/tst-itimer.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/time/tst-itimer.c b/time/tst-itimer.c index bd7d7afe83..af97ef6acf 100644 --- a/time/tst-itimer.c +++ b/time/tst-itimer.c @@ -25,6 +25,12 @@ #include #include +#ifdef __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 +# define ITIMER_SUPPORTS_TIMESPEC64 __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 +#else +# define ITIMER_SUPPORTS_TIMESPEC64 (sizeof (__time_t) == 8) +#endif + static sig_atomic_t cnt; static void @@ -100,7 +106,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 (ITIMER_SUPPORTS_TIMESPEC64) { TEST_COMPARE (setitimer (timers[i], &it, NULL), 0); TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { 0 }, @@ -131,7 +137,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 (ITIMER_SUPPORTS_TIMESPEC64) { TEST_COMPARE (setitimer (timers[i], &it, NULL), 0);