From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by sourceware.org (Postfix) with ESMTPS id DF243385781F for ; Thu, 18 Mar 2021 13:31:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DF243385781F Received: by mail-qt1-x833.google.com with SMTP id r14so4010824qtt.7 for ; Thu, 18 Mar 2021 06:31:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=f3fZP35lE7xePkJSYDJJ1pgbYf3l/9qahpedYY+GSSU=; b=dTv43HIGQiwfhbmGz3+1lOo73wr+3B41fxxNLEobUq9vG+dH0JmB4x+AINvTXhCTE6 IckvplHyNSC2JtsT31TTUX0x2jWaJdU4yzW/li68vWj/S39khthQQ54YtDWZbyBMHaDV 1qwqMLLKQgaCBdkf2Qob1UUDbVQjW62T1VXz4bcB9sdnwl07cERHwZGFjw/wCuSUMcgC EwsT4mgn3qWAbajLDlVzGzCvDutXqLDCkiRkAzWCUpBR6BBUk9eq5kx0SCYzG2YwFeQh fQUGit5UxvklAhia4h+DKrLCEY8hYAG6wlr/qzAYR3BVbk42RR7iOOcFFC+iAd/vajIs 8RxQ== X-Gm-Message-State: AOAM5332iVaJ/TQ1oCOdxMb9kmXtrJz6aO66bg4nzKe1dBARSaCMdscV 2jFShLwF/88suyAHokciqjWfaw== X-Google-Smtp-Source: ABdhPJyloLhfZm4BOzn5dye19mObA+ZzFios9v+RYdC7UTv9jz1CVz1Y/XUapbQIfk0KRX4+ZBqmYg== X-Received: by 2002:ac8:5e89:: with SMTP id r9mr3767752qtx.10.1616074265426; Thu, 18 Mar 2021 06:31:05 -0700 (PDT) Received: from [192.168.1.4] ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id n3sm1384076qtd.93.2021.03.18.06.31.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Mar 2021 06:31:05 -0700 (PDT) To: Stefan Liebler , libc-alpha@sourceware.org, Joseph Myers References: <20210317130352.1782897-1-stli@linux.ibm.com> From: Adhemerval Zanella Subject: Re: [PATCH] S390: Don't test nanoseconds in io/tst-stat.c Message-ID: <1b859ba2-29bf-03f9-7b5d-db5b451857db@linaro.org> Date: Thu, 18 Mar 2021 10:31:01 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210317130352.1782897-1-stli@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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: Thu, 18 Mar 2021 13:31:07 -0000 On 17/03/2021 10:03, Stefan Liebler wrote: > Both new tests io/tst-stat and io/tst-stat-lfs (_FILE_OFFSET_BITS=64) > are comparing the nanosecond fields with the statx result. Unfortunately > on s390(31bit) those fields are always zero if old KABI with non-LFS > support is used. With _FILE_OFFSET_BITS=64 stat is using statx internally. > > As suggested by Adhemerval this patch disables the nanosecond check for > s390(31bit). LGTM, the fstatat call does not call statx and even for LFS that call statx it might ended calling old stat syscall in the fallback part that does not About the __ASSUME_STATX note Joseph has raised, I think we should add it on Linux at least for fstatat64 implementation. However it does not really help on the fstatat one. I will try to spare some time to make fstatat.c use statx as well, so we can tie the test to __ASSUME_STATX. Reviewed-by: Adhemerval Zanella > --- > io/tst-stat.c | 7 +++++-- > support/Makefile | 1 + > support/support.h | 3 +++ > support/support_stat_nanoseconds.c | 31 ++++++++++++++++++++++++++++++ > 4 files changed, 40 insertions(+), 2 deletions(-) > create mode 100644 support/support_stat_nanoseconds.c > > diff --git a/io/tst-stat.c b/io/tst-stat.c > index 445ac4176c..397d480ecc 100644 > --- a/io/tst-stat.c > +++ b/io/tst-stat.c > @@ -91,9 +91,12 @@ do_test (void) > TEST_COMPARE (stx.stx_blocks, st.st_blocks); > > TEST_COMPARE (stx.stx_ctime.tv_sec, st.st_ctim.tv_sec); > - TEST_COMPARE (stx.stx_ctime.tv_nsec, st.st_ctim.tv_nsec); > TEST_COMPARE (stx.stx_mtime.tv_sec, st.st_mtim.tv_sec); > - TEST_COMPARE (stx.stx_mtime.tv_nsec, st.st_mtim.tv_nsec); > + if (support_stat_nanoseconds ()) > + { > + TEST_COMPARE (stx.stx_ctime.tv_nsec, st.st_ctim.tv_nsec); > + TEST_COMPARE (stx.stx_mtime.tv_nsec, st.st_mtim.tv_nsec); > + } > } > > return 0; > diff --git a/support/Makefile b/support/Makefile > index fc9f4936a8..900e17f94f 100644 > --- a/support/Makefile > +++ b/support/Makefile > @@ -71,6 +71,7 @@ libsupport-routines = \ > support_set_small_thread_stack_size \ > support_shared_allocate \ > support_small_stack_thread_attribute \ > + support_stat_nanoseconds \ > support_subprocess \ > support_test_compare_blob \ > support_test_compare_failure \ > diff --git a/support/support.h b/support/support.h > index 2e477c9e7c..90f3ff9d1a 100644 > --- a/support/support.h > +++ b/support/support.h > @@ -134,6 +134,9 @@ extern ssize_t support_copy_file_range (int, off64_t *, int, off64_t *, > operations (such as fstatat or utimensat). */ > extern bool support_path_support_time64 (const char *path); > > +/* Return true if stat supports nanoseconds resolution. */ > +extern bool support_stat_nanoseconds (void); > + > __END_DECLS > > #endif /* SUPPORT_H */ > diff --git a/support/support_stat_nanoseconds.c b/support/support_stat_nanoseconds.c > new file mode 100644 > index 0000000000..c0d5b2c3a9 > --- /dev/null > +++ b/support/support_stat_nanoseconds.c > @@ -0,0 +1,31 @@ > +/* Check if stat supports nanosecond resolution. > + Copyright (C) 2021 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#include > + > +bool > +support_stat_nanoseconds (void) > +{ > + /* s390 stat64 compat symbol does not support nanoseconds resolution > + and it used on non-LFS [f,l]stat[at] implementations. */ > +#if defined __linux__ && !defined __s390x__ && defined __s390__ > + return false; > +#else > + return true; > +#endif > +} >