From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by sourceware.org (Postfix) with ESMTPS id 65DAF386FC37 for ; Wed, 19 May 2021 11:04:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 65DAF386FC37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lukma@denx.de Received: from ktm (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 38D9380202; Wed, 19 May 2021 13:04:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1621422290; bh=E28urbVYpyXA53Q9F6/JOqvu4IeLGO86nX1LMRpIc9M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TkpsyDjyIdMvPdTIKbe6VAGGwEoJusp6AtNkxeswsoTDb9FOlLv1kp5pbJmlL99jg bdB09KqY+1RkNXinlL3M0pI3qwrhZM8nlvjpu+RIC6UIzeLCA2CjBManDrEgSiqlW8 nitH5iW+yTEEUNZnwpRuWXAwVMf28OnITHOLpSYCET/vVooCh4kxMIwj3UtNwDHfaD O0Y4jTTqr7BlM8LYxedrJGLvcCe6Ve1Jt1kR+j2+v2qdrbsXhO4FZJKd3geDDFl5Wl imvriGXsGcWgPeY8pZ6Fv77g6+IgiTfNQgd6stvxHEmDNQoL08xggI4olyUc/+Ji0X kVuz3vJ/Dg14Q== Date: Wed, 19 May 2021 13:04:49 +0200 From: Lukasz Majewski To: Adhemerval Zanella Cc: libc-alpha@sourceware.org, Carlos O'Donell Subject: Re: [PATCH v2 24/25] libsupport: Add 64 bit time_t support for stat functions Message-ID: <20210519130449.2e4b8096@ktm> In-Reply-To: <20210518205613.1487824-25-adhemerval.zanella@linaro.org> References: <20210518205613.1487824-1-adhemerval.zanella@linaro.org> <20210518205613.1487824-25-adhemerval.zanella@linaro.org> Organization: denx.de X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/JNVrVAHpZlYdO9O8FF002T+"; protocol="application/pgp-signature" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, 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, 19 May 2021 11:04:53 -0000 --Sig_/JNVrVAHpZlYdO9O8FF002T+ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 18 May 2021 17:56:12 -0300 Adhemerval Zanella wrote: > The patch adds redirections for xstat, xlstat, and xfstat when > _TIME_BITS=3D64 is defined. Reviewed-by: Lukasz Majewski > --- > 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 >=20 > diff --git a/support/Makefile b/support/Makefile > index 1ee73f81bc..8b8534a3c6 100644 > --- a/support/Makefile > +++ b/support/Makefile > @@ -40,7 +40,9 @@ libsupport-routines =3D \ > 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 =3D \ > 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 !=3D 64 > +void > +xfstat_time64 (int fd, struct __stat64_t64 *result) > +{ > + if (__fstat64_time64 (fd, result) !=3D 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 !=3D 64 > +void > +xstat_time64 (const char *path, struct __stat64_t64 *result) > +{ > + if (__stat64_time64 (path, result) !=3D 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 !=3D 64 > +void > +xlstat_time64 (const char *path, struct __stat64_t64 *result) > +{ > + if (__lstat64_time64 (path, result) !=3D 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 @@ > =20 > #include > #include > +#include > #include > =20 > __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); Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de --Sig_/JNVrVAHpZlYdO9O8FF002T+ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAmCk8NEACgkQAR8vZIA0 zr0Zbwf/QDczS9Rm6GzKa5FPKru4lBrF6dlok5fI8rdmM3twJ7csG9iKDAXCrQlf 8IKbuHV7KJ7OLSgxdCWiiFNKdm5v5XpXOna4iAz+7ArWF1U5qqlYui8s5f8FEQX6 E6l5toVl1AUPwytWUhLPwusuRTM3KsPxh+s2BEGD5v6iFtmFAD4UwCBqCmSrJObb /v8h8AJE7xROGKnWLLov+r/4uujJX3O2EVFajLQj8WGL4EJjSHiq9kWEckV/BhXE es4d8gJs4iJswg/fkQ2CFzP2Gw6wtPhvQmg6vT5g2IRkweoMjwXzJEyOqddpCyrf mHAclX3zN8gQcGBJVMeN3NhmTnFn7A== =Zjd4 -----END PGP SIGNATURE----- --Sig_/JNVrVAHpZlYdO9O8FF002T+--