From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 292E639A002A for ; Fri, 4 Jun 2021 19:39:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 292E639A002A Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-469-CUQo_XhEOiKR_gJc4yy80Q-1; Fri, 04 Jun 2021 15:39:36 -0400 X-MC-Unique: CUQo_XhEOiKR_gJc4yy80Q-1 Received: by mail-qt1-f200.google.com with SMTP id h24-20020ac856980000b0290243c83a3ddcso4938094qta.1 for ; Fri, 04 Jun 2021 12:39:36 -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:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Q4LRrVAIjlW4UXIqz121DhU6HBQPAb+EaQcvwGCoX3U=; b=cgGFCc5XGgj6Be6gG38OHtQWkBqsTXUAbyGcqY5RPSQ414DHn9/8joobHW19OY/L69 D4ZZ/MFIqRPxVuA9YxDhRQSdWXT2QrD6th4b87DqUTcxrSjE5OFPWdM3iW7565C63ZBc g6rBdyldJcNhy4CEHNl4l8a/UGnMF3rzSR6SnatXi02wwDRgkIG7E6rMCQQs8Kqs9kU7 8qMxsexVgE3Aw3lvUuZE5elZYHNV/nI8JNU2HPLXHwrYDEEgV+xg2lJ9lwhoCmbkfj8A eHjrL1Vi3GZwSJJuz6IFWD3Nz0PVtXfnLf1UPQ7031qZCtP+gjdtAZhFEVWeKHl7w0ox Drbw== X-Gm-Message-State: AOAM531jjqKm8Cbr9rWjOvXhbehJ1EG0n1ABM2YaodE7k10jmglZpoWT TtPCspZJHea7dwbN4m5jDTtFGFjRstQLP6ttf6mbCGRcNfDaJq6u/EjBPq89LAnd9ePmmejytUb XEYyoDuyxF007Y/7mVBtd X-Received: by 2002:ac8:4f03:: with SMTP id b3mr4380310qte.162.1622835575611; Fri, 04 Jun 2021 12:39:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx79btunk0/MbZjsF5v9NO7Vi1kV80Z5a8TwQ4auuS+uBDNr+l73XefJYN8Ba4XT6bJ5dXwag== X-Received: by 2002:ac8:4f03:: with SMTP id b3mr4380301qte.162.1622835575398; Fri, 04 Jun 2021 12:39:35 -0700 (PDT) Received: from [192.168.1.16] (198-84-214-74.cpe.teksavvy.com. [198.84.214.74]) by smtp.gmail.com with ESMTPSA id p11sm4607431qkj.3.2021.06.04.12.39.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Jun 2021 12:39:35 -0700 (PDT) Subject: Re: [PATCH v2 24/25] libsupport: Add 64 bit time_t support for stat functions To: Adhemerval Zanella , libc-alpha@sourceware.org References: <20210518205613.1487824-1-adhemerval.zanella@linaro.org> <20210518205613.1487824-25-adhemerval.zanella@linaro.org> From: Carlos O'Donell Organization: Red Hat Message-ID: <4c1dd715-c857-cdc8-7f07-3ac76ad28b8e@redhat.com> Date: Fri, 4 Jun 2021 15:39:34 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210518205613.1487824-25-adhemerval.zanella@linaro.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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: Fri, 04 Jun 2021 19:39:48 -0000 On 5/18/21 4:56 PM, Adhemerval Zanella wrote: > The patch adds redirections for xstat, xlstat, and xfstat when > _TIME_BITS=64 is defined. LGTM. No regressions on x86_64, i686, ppc64le, aarch64, s390x. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell > --- > support/Makefile | 3 +++ > support/support-xfstat-time64.c | 32 ++++++++++++++++++++++++++++++++ > support/support-xstat-time64.c | 32 ++++++++++++++++++++++++++++++++ > support/xlstat-time64.c | 32 ++++++++++++++++++++++++++++++++ > support/xunistd.h | 13 +++++++++++++ > 5 files changed, 112 insertions(+) > create mode 100644 support/support-xfstat-time64.c > create mode 100644 support/support-xstat-time64.c > create mode 100644 support/xlstat-time64.c > > diff --git a/support/Makefile b/support/Makefile > index 1ee73f81bc..8b8534a3c6 100644 > --- a/support/Makefile > +++ b/support/Makefile > @@ -40,7 +40,9 @@ libsupport-routines = \ > resolv_test \ > set_fortify_handler \ > support-xfstat \ > + support-xfstat-time64 \ > support-xstat \ > + support-xstat-time64 \ > support_become_root \ > support_can_chroot \ > support_capture_subprocess \ > @@ -117,6 +119,7 @@ libsupport-routines = \ > xlisten \ > xlseek \ > xlstat \ > + xlstat-time64 \ > xmalloc \ > xmemstream \ > xmkdir \ > diff --git a/support/support-xfstat-time64.c b/support/support-xfstat-time64.c > new file mode 100644 > index 0000000000..324c5d20d2 > --- /dev/null > +++ b/support/support-xfstat-time64.c > @@ -0,0 +1,32 @@ > +/* 64-bit time_t stat with error checking. > + 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 > + . */ > + > +/* NB: Non-standard file name to avoid sysdeps override for xstat. */ > + > +#include > +#include > +#include > + > +#if __TIMESIZE != 64 > +void > +xfstat_time64 (int fd, struct __stat64_t64 *result) > +{ > + if (__fstat64_time64 (fd, result) != 0) > + FAIL_EXIT1 ("__fstat64_time64 (%d): %m", fd); > +} > +#endif > diff --git a/support/support-xstat-time64.c b/support/support-xstat-time64.c > new file mode 100644 > index 0000000000..7d0194b98a > --- /dev/null > +++ b/support/support-xstat-time64.c > @@ -0,0 +1,32 @@ > +/* 64-bit time_t stat with error checking. > + 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 > + . */ > + > +/* NB: Non-standard file name to avoid sysdeps override for xstat. */ > + > +#include > +#include > +#include > + > +#if __TIMESIZE != 64 > +void > +xstat_time64 (const char *path, struct __stat64_t64 *result) > +{ > + if (__stat64_time64 (path, result) != 0) > + FAIL_EXIT1 ("__stat64_time64 (\"%s\"): %m", path); > +} > +#endif > diff --git a/support/xlstat-time64.c b/support/xlstat-time64.c > new file mode 100644 > index 0000000000..ef4d922635 > --- /dev/null > +++ b/support/xlstat-time64.c > @@ -0,0 +1,32 @@ > +/* 64-bit time_t stat with error checking. > + 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 > + . */ > + > +/* NB: Non-standard file name to avoid sysdeps override for xstat. */ > + > +#include > +#include > +#include > + > +#if __TIMESIZE != 64 > +void > +xlstat_time64 (const char *path, struct __stat64_t64 *result) > +{ > + if (__lstat64_time64 (path, result) != 0) > + FAIL_EXIT1 ("__lstat64_time64 (\"%s\"): %m", path); > +} > +#endif > diff --git a/support/xunistd.h b/support/xunistd.h > index c642588c29..e4ade65c85 100644 > --- a/support/xunistd.h > +++ b/support/xunistd.h > @@ -24,6 +24,7 @@ > > #include > #include > +#include > #include > > __BEGIN_DECLS > @@ -35,9 +36,21 @@ pid_t xwaitpid (pid_t, int *status, int flags); > void xpipe (int[2]); > void xdup2 (int, int); > int xopen (const char *path, int flags, mode_t); > +#ifndef __USE_TIME_BITS64 > +# ifdef __USE_FILE_OFFSET64 > +void xstat (const char *path, struct stat *); > +void xlstat (const char *path, struct stat *); > +void xfstat (int fd, struct stat *); > +# else > void xstat (const char *path, struct stat64 *); > void xlstat (const char *path, struct stat64 *); > void xfstat (int fd, struct stat64 *); > +# endif > +#else > +void __REDIRECT (xstat, (const char *path, struct stat *), xstat_time64); > +void __REDIRECT (xlstat, (const char *path, struct stat *), xlstat_time64); > +void __REDIRECT (xfstat, (int fd, struct stat *), xfstat_time64); > +#endif > void xmkdir (const char *path, mode_t); > void xchroot (const char *path); > void xunlink (const char *path); > -- Cheers, Carlos.