unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Alistair Francis <alistair.francis@wdc.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH 12/16] linux: Implement {l}fstat{at} in terms of fstatat
Date: Fri, 24 Jul 2020 11:29:17 +0200	[thread overview]
Message-ID: <20200724112917.47a2083d@jawa> (raw)
In-Reply-To: <20200723194641.1949404-13-adhemerval.zanella@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 13783 bytes --]

On Thu, 23 Jul 2020 16:46:37 -0300
Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> Both fstatat and fstata64 calls the old fxstatat and fxstatat64
> repectivelly with _STAT_VER, the one currently exported as default
> for all ABIs.
> 
> Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>

> ---
>  sysdeps/unix/sysv/linux/fstat.c     | 31 +++++++++++++++++++++++
>  sysdeps/unix/sysv/linux/fstat64.c   | 38
> +++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/fstatat.c   |
> 30 +++++++++++++++++++++++ sysdeps/unix/sysv/linux/fstatat64.c | 38
> +++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/lstat.c     |
> 31 +++++++++++++++++++++++ sysdeps/unix/sysv/linux/lstat64.c   | 38
> +++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/stat.c      |
> 31 +++++++++++++++++++++++ sysdeps/unix/sysv/linux/stat64.c    | 38
> +++++++++++++++++++++++++++++ 8 files changed, 275 insertions(+)
>  create mode 100644 sysdeps/unix/sysv/linux/fstat.c
>  create mode 100644 sysdeps/unix/sysv/linux/fstat64.c
>  create mode 100644 sysdeps/unix/sysv/linux/fstatat.c
>  create mode 100644 sysdeps/unix/sysv/linux/fstatat64.c
>  create mode 100644 sysdeps/unix/sysv/linux/lstat.c
>  create mode 100644 sysdeps/unix/sysv/linux/lstat64.c
>  create mode 100644 sysdeps/unix/sysv/linux/stat.c
>  create mode 100644 sysdeps/unix/sysv/linux/stat64.c
> 
> diff --git a/sysdeps/unix/sysv/linux/fstat.c
> b/sysdeps/unix/sysv/linux/fstat.c new file mode 100644
> index 0000000000..bdbeded956
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/fstat.c
> @@ -0,0 +1,31 @@
> +/* Get file status.  Linux version.
> +   Copyright (C) 2020 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
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <sys/stat.h>
> +#include <kernel_stat.h>
> +#include <fcntl.h>
> +
> +#if !XSTAT_IS_XSTAT64
> +int
> +__fstat (int fd, struct stat *buf)
> +{
> +  return __fstatat (fd, "", buf, AT_EMPTY_PATH);
> +}
> +
> +weak_alias (__fstat, fstat)
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/fstat64.c
> b/sysdeps/unix/sysv/linux/fstat64.c new file mode 100644
> index 0000000000..c2ff1ff577
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/fstat64.c
> @@ -0,0 +1,38 @@
> +/* Get file status.  Linux version.
> +   Copyright (C) 2020 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
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#define __fstat __redirect___fstat
> +#define fstat   __redirect_fstat
> +#include <sys/stat.h>
> +#undef __fstat
> +#undef fstat
> +#include <fcntl.h>
> +#include <kernel_stat.h>
> +
> +int
> +__fstat64 (int fd, struct stat64 *buf)
> +{
> +  return __fstatat64 (fd, "", buf, AT_EMPTY_PATH);
> +}
> +hidden_def (__fstat64)
> +weak_alias (__fstat64, fstat64)
> +
> +#if XSTAT_IS_XSTAT64
> +strong_alias (__fstat64, __fstat)
> +weak_alias (__fstat64, fstat)
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/fstatat.c
> b/sysdeps/unix/sysv/linux/fstatat.c new file mode 100644
> index 0000000000..457496605c
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/fstatat.c
> @@ -0,0 +1,30 @@
> +/* Get file status.  Linux version.
> +   Copyright (C) 2020 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
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <sys/stat.h>
> +#include <kernel_stat.h>
> +
> +#if !XSTAT_IS_XSTAT64
> +int
> +__fstatat (int fd, const char *file, struct stat *buf, int flag)
> +{
> +  return __fxstatat (_STAT_VER, fd, file, buf, flag);
> +}
> +
> +weak_alias (__fstatat, fstatat)
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/fstatat64.c
> b/sysdeps/unix/sysv/linux/fstatat64.c new file mode 100644
> index 0000000000..46487919e6
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/fstatat64.c
> @@ -0,0 +1,38 @@
> +/* Get file status.  Linux version.
> +   Copyright (C) 2020 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
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#define __fstatat __redirect___fstatat
> +#define fstatat   __redirect_fstatat
> +#include <sys/stat.h>
> +#undef __fstatat
> +#undef fstatat
> +#include <kernel_stat.h>
> +
> +int
> +__fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
> +{
> +  return __fxstatat64 (_STAT_VER, fd, file, buf, flag);
> +}
> +hidden_def (__fstatat64)
> +weak_alias (__fstatat64, fstatat64)
> +
> +#if XSTAT_IS_XSTAT64
> +strong_alias (__fstatat64, __fstatat)
> +weak_alias (__fstatat64, fstatat)
> +strong_alias (__fstatat64, __GI___fstatat);
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/lstat.c
> b/sysdeps/unix/sysv/linux/lstat.c new file mode 100644
> index 0000000000..b0bdeee9e9
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/lstat.c
> @@ -0,0 +1,31 @@
> +/* Get file status.  Linux version.
> +   Copyright (C) 2020 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
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <sys/stat.h>
> +#include <fcntl.h>
> +#include <kernel_stat.h>
> +
> +#if !XSTAT_IS_XSTAT64
> +int
> +__lstat (const char *file, struct stat *buf)
> +{
> +  return __fstatat (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW);
> +}
> +
> +weak_alias (__lstat, lstat)
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/lstat64.c
> b/sysdeps/unix/sysv/linux/lstat64.c new file mode 100644
> index 0000000000..e5f02e9822
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/lstat64.c
> @@ -0,0 +1,38 @@
> +/* Get file status.
> +   Copyright (C) 1996-2020 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
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#define __lstat __redirect___lstat
> +#define lstat   __redirect_lstat
> +#include <sys/stat.h>
> +#undef __lstat
> +#undef lstat
> +#include <fcntl.h>
> +#include <kernel_stat.h>
> +
> +int
> +__lstat64 (const char *file, struct stat64 *buf)
> +{
> +  return __fstatat64 (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW);
> +}
> +hidden_def (__lstat64)
> +weak_alias (__lstat64, lstat64)
> +
> +#if XSTAT_IS_XSTAT64
> +strong_alias (__lstat64, __lstat)
> +weak_alias (__lstat64, lstat)
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/stat.c
> b/sysdeps/unix/sysv/linux/stat.c new file mode 100644
> index 0000000000..a77502eb95
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/stat.c
> @@ -0,0 +1,31 @@
> +/* Get file status.  Linux version.
> +   Copyright (C) 2020 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
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <sys/stat.h>
> +#include <fcntl.h>
> +#include <kernel_stat.h>
> +
> +#if !XSTAT_IS_XSTAT64
> +int
> +__stat (const char *file, struct stat *buf)
> +{
> +  return __fstatat (AT_FDCWD, file, buf, 0);
> +}
> +
> +weak_alias (__stat, stat)
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/stat64.c
> b/sysdeps/unix/sysv/linux/stat64.c new file mode 100644
> index 0000000000..2f40037c2c
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/stat64.c
> @@ -0,0 +1,38 @@
> +/* Get file status.  Linux version.
> +   Copyright (C) 2020 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
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#define __stat __redirect___stat
> +#define stat   __redirect_stat
> +#include <sys/stat.h>
> +#undef __stat
> +#undef stat
> +#include <fcntl.h>
> +#include <kernel_stat.h>
> +
> +int
> +__stat64 (const char *file, struct stat64 *buf)
> +{
> +  return __fstatat64 (AT_FDCWD, file, buf, 0);
> +}
> +hidden_def (__stat64)
> +weak_alias (__stat64, stat64)
> +
> +#if XSTAT_IS_XSTAT64
> +strong_alias (__stat64, __stat)
> +weak_alias (__stat64, stat)
> +#endif




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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-07-24  9:29 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 19:46 [PATCH 00/16] Add y2038 support for stat functions Adhemerval Zanella via Libc-alpha
2020-07-23 19:46 ` [PATCH 01/16] linux: Always define STAT_IS_KERNEL_STAT Adhemerval Zanella via Libc-alpha
2020-07-24  8:17   ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 02/16] linux: Define STAT64_IS_KERNEL_STAT64 Adhemerval Zanella via Libc-alpha
2020-07-24  8:20   ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 03/16] linux: Consolidate xstat{64} Adhemerval Zanella via Libc-alpha
2020-07-23 20:51   ` Joseph Myers
2020-07-24  8:34   ` Lukasz Majewski
2020-09-09 14:46   ` Lukasz Majewski
2020-09-09 18:05     ` Adhemerval Zanella via Libc-alpha
2020-09-10  7:10       ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 04/16] linux: Consolidate lxstat{64} Adhemerval Zanella via Libc-alpha
2020-07-24  8:43   ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 05/16] linux: Consolidate fxstat{64} Adhemerval Zanella via Libc-alpha
2020-07-24  9:04   ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 06/16] linux: Consolidate fxstatat{64} Adhemerval Zanella via Libc-alpha
2020-07-24  9:14   ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 07/16] Linux: Consolidate xmknod Adhemerval Zanella via Libc-alpha
2020-07-24  9:14   ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 08/16] Remove internal usage of extensible stat functions Adhemerval Zanella via Libc-alpha
2020-07-24  9:16   ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 09/16] Remove stat wrapper functions, move them to exported symbols Adhemerval Zanella via Libc-alpha
2020-07-24  9:23   ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 10/16] Remove mknod wrapper functions, move them to symbols Adhemerval Zanella via Libc-alpha
2020-07-23 20:53   ` Joseph Myers
2020-07-23 20:58     ` Adhemerval Zanella via Libc-alpha
2020-07-23 21:01       ` Joseph Myers
2020-07-24  9:25   ` Lukasz Majewski
2020-10-12 22:27   ` Joseph Myers
2020-10-13  0:58     ` Adhemerval Zanella via Libc-alpha
2020-07-23 19:46 ` [PATCH 11/16] linux: Move the struct stat{64} to struct_stat.h Adhemerval Zanella via Libc-alpha
2020-07-24  9:27   ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 12/16] linux: Implement {l}fstat{at} in terms of fstatat Adhemerval Zanella via Libc-alpha
2020-07-24  9:29   ` Lukasz Majewski [this message]
2020-07-23 19:46 ` [PATCH 13/16] linux: Disentangle fstatat from fxstatat Adhemerval Zanella via Libc-alpha
2020-07-24  9:39   ` Lukasz Majewski
2020-07-24 10:25   ` Florian Weimer via Libc-alpha
2020-07-24 14:39     ` Adhemerval Zanella via Libc-alpha
2020-07-23 19:46 ` [PATCH 14/16] linux: Move {f}xstat{at} to compat symbols Adhemerval Zanella via Libc-alpha
2020-07-24  9:40   ` Lukasz Majewski
2020-10-21  5:21   ` __xstat et al. as compat symbols (was: Re: [PATCH 14/16] linux: Move {f}xstat{at} to compat symbols) Florian Weimer via Libc-alpha
2020-10-21 11:59     ` Adhemerval Zanella via Libc-alpha
2020-10-21 12:57       ` __xstat et al. as compat symbols Florian Weimer via Libc-alpha
2020-10-21 13:09         ` Adhemerval Zanella via Libc-alpha
2020-10-22 10:08           ` Florian Weimer via Libc-alpha
2020-10-22 12:43             ` Adhemerval Zanella via Libc-alpha
2020-10-22 15:37               ` Florian Weimer via Libc-alpha
2020-10-22 16:40                 ` Adhemerval Zanella via Libc-alpha
2020-10-22 18:04                   ` Adhemerval Zanella via Libc-alpha
2020-07-23 19:46 ` [PATCH 15/16] linux: Add {f}stat{at} y2038 support Adhemerval Zanella via Libc-alpha
2020-07-23 20:55   ` Joseph Myers
2020-07-23 21:00     ` Adhemerval Zanella via Libc-alpha
2020-07-24 10:53   ` Lukasz Majewski
2020-07-30 12:42     ` Adhemerval Zanella via Libc-alpha
2020-08-02 19:46       ` Maciej W. Rozycki via Libc-alpha
2020-10-06  9:48   ` Lukasz Majewski
2020-10-07 12:52     ` Adhemerval Zanella via Libc-alpha
2020-10-07 14:25       ` Adhemerval Zanella via Libc-alpha
2020-10-07 20:20         ` Lukasz Majewski
2020-10-07 21:01           ` Adhemerval Zanella via Libc-alpha
2020-10-07 21:07         ` Adhemerval Zanella via Libc-alpha
2020-10-08  7:57           ` Lukasz Majewski
2020-10-09 14:05             ` Adhemerval Zanella via Libc-alpha
2020-10-09 15:39               ` Lukasz Majewski
2020-10-09 20:06                 ` Adhemerval Zanella via Libc-alpha
2020-10-13 13:58         ` Lukasz Majewski
2020-10-13 14:18           ` Adhemerval Zanella via Libc-alpha
2020-10-13 14:23             ` H.J. Lu via Libc-alpha
2020-10-13 14:27               ` Adhemerval Zanella via Libc-alpha
2020-10-13 18:14             ` Adhemerval Zanella via Libc-alpha
2020-10-13 21:20               ` Lukasz Majewski
2020-10-13 21:40             ` Lukasz Majewski
2020-10-14 13:15               ` Lukasz Majewski
2020-10-14 13:39                 ` Adhemerval Zanella via Libc-alpha
2020-07-23 19:46 ` [PATCH 16/16] linux: Move xmknoda{at} to compat symbols Adhemerval Zanella via Libc-alpha
2020-07-24 10:30   ` Florian Weimer via Libc-alpha
2020-07-24 12:34     ` Adhemerval Zanella via Libc-alpha
2020-07-24 12:43       ` Florian Weimer via Libc-alpha
2020-07-24 12:49         ` Adhemerval Zanella via Libc-alpha
2020-07-24 10:43   ` Lukasz Majewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200724112917.47a2083d@jawa \
    --to=lukma@denx.de \
    --cc=adhemerval.zanella@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).