[08/16] Remove internal usage of extensible stat functions
Commit Message
It replaces the internal usage of __{f,l}xstat{at}{64} with the
__{f,l}stat{at}{64}. It should not change the generate code since
sys/stat.h explicit defines redirections to internal calls back to
xstat* symbols.
Checked with a build for all affected ABIs. I also check on
x86_64-linux-gnu and i686-linux-gnu.
---
catgets/open_catalog.c | 2 +-
csu/check_fds.c | 2 +-
elf/cache.c | 4 +--
elf/dl-load.c | 4 +--
elf/dl-misc.c | 2 +-
elf/dl-profile.c | 2 +-
iconv/gconv_cache.c | 2 +-
include/sys/stat.h | 1 +
inet/rcmd.c | 4 +--
inet/ruserpass.c | 2 +-
intl/loadmsgcat.c | 2 +-
io/file_change_detection.c | 4 +--
io/fts.c | 15 +++++-----
io/fts64.c | 5 ++--
io/ftw.c | 46 ++++++++++++++---------------
io/ftw64.c | 8 ++---
io/getdirname.c | 4 +--
io/mkdirat.c | 2 +-
io/mkfifoat.c | 2 +-
io/openat.c | 2 +-
io/openat64.c | 2 +-
io/xmknodat.c | 2 +-
libio/fileops.c | 2 +-
locale/loadarchive.c | 4 +--
locale/loadlocale.c | 4 +--
misc/daemon.c | 2 +-
misc/getusershell.c | 2 +-
nptl/sem_open.c | 2 +-
nscd/nscd_helper.c | 2 +-
posix/glob.c | 7 -----
stdlib/canonicalize.c | 2 +-
sysdeps/gnu/glob64-lstat-compat.c | 2 +-
sysdeps/gnu/glob64.c | 2 +-
sysdeps/mach/hurd/ptsname.c | 2 +-
sysdeps/posix/dl-fileid.h | 2 +-
sysdeps/posix/euidaccess.c | 2 +-
sysdeps/posix/fdopendir.c | 2 +-
sysdeps/posix/fpathconf.c | 2 +-
sysdeps/posix/getaddrinfo.c | 4 +--
sysdeps/posix/isfdtype.c | 2 +-
sysdeps/posix/opendir.c | 2 +-
sysdeps/posix/pathconf.c | 2 +-
sysdeps/posix/posix_fallocate.c | 2 +-
sysdeps/posix/posix_fallocate64.c | 2 +-
sysdeps/posix/sysconf.c | 2 +-
sysdeps/posix/tempname.c | 5 ++--
sysdeps/unix/sysv/linux/faccessat.c | 2 +-
sysdeps/unix/sysv/linux/fexecve.c | 4 +--
sysdeps/unix/sysv/linux/oldglob.c | 2 +-
sysdeps/unix/sysv/linux/pathconf.c | 4 +--
sysdeps/unix/sysv/linux/ptsname.c | 4 +--
sysdeps/unix/sysv/linux/ttyname.c | 8 ++---
sysdeps/unix/sysv/linux/ttyname_r.c | 8 ++---
sysvipc/ftok.c | 2 +-
time/getdate.c | 2 +-
time/tzfile.c | 4 +--
56 files changed, 108 insertions(+), 113 deletions(-)
Comments
On Thu, 23 Jul 2020 16:46:33 -0300
Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> It replaces the internal usage of __{f,l}xstat{at}{64} with the
> __{f,l}stat{at}{64}. It should not change the generate code since
> sys/stat.h explicit defines redirections to internal calls back to
> xstat* symbols.
>
> Checked with a build for all affected ABIs. I also check on
> x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
> ---
> catgets/open_catalog.c | 2 +-
> csu/check_fds.c | 2 +-
> elf/cache.c | 4 +--
> elf/dl-load.c | 4 +--
> elf/dl-misc.c | 2 +-
> elf/dl-profile.c | 2 +-
> iconv/gconv_cache.c | 2 +-
> include/sys/stat.h | 1 +
> inet/rcmd.c | 4 +--
> inet/ruserpass.c | 2 +-
> intl/loadmsgcat.c | 2 +-
> io/file_change_detection.c | 4 +--
> io/fts.c | 15 +++++-----
> io/fts64.c | 5 ++--
> io/ftw.c | 46
> ++++++++++++++--------------- io/ftw64.c |
> 8 ++--- io/getdirname.c | 4 +--
> io/mkdirat.c | 2 +-
> io/mkfifoat.c | 2 +-
> io/openat.c | 2 +-
> io/openat64.c | 2 +-
> io/xmknodat.c | 2 +-
> libio/fileops.c | 2 +-
> locale/loadarchive.c | 4 +--
> locale/loadlocale.c | 4 +--
> misc/daemon.c | 2 +-
> misc/getusershell.c | 2 +-
> nptl/sem_open.c | 2 +-
> nscd/nscd_helper.c | 2 +-
> posix/glob.c | 7 -----
> stdlib/canonicalize.c | 2 +-
> sysdeps/gnu/glob64-lstat-compat.c | 2 +-
> sysdeps/gnu/glob64.c | 2 +-
> sysdeps/mach/hurd/ptsname.c | 2 +-
> sysdeps/posix/dl-fileid.h | 2 +-
> sysdeps/posix/euidaccess.c | 2 +-
> sysdeps/posix/fdopendir.c | 2 +-
> sysdeps/posix/fpathconf.c | 2 +-
> sysdeps/posix/getaddrinfo.c | 4 +--
> sysdeps/posix/isfdtype.c | 2 +-
> sysdeps/posix/opendir.c | 2 +-
> sysdeps/posix/pathconf.c | 2 +-
> sysdeps/posix/posix_fallocate.c | 2 +-
> sysdeps/posix/posix_fallocate64.c | 2 +-
> sysdeps/posix/sysconf.c | 2 +-
> sysdeps/posix/tempname.c | 5 ++--
> sysdeps/unix/sysv/linux/faccessat.c | 2 +-
> sysdeps/unix/sysv/linux/fexecve.c | 4 +--
> sysdeps/unix/sysv/linux/oldglob.c | 2 +-
> sysdeps/unix/sysv/linux/pathconf.c | 4 +--
> sysdeps/unix/sysv/linux/ptsname.c | 4 +--
> sysdeps/unix/sysv/linux/ttyname.c | 8 ++---
> sysdeps/unix/sysv/linux/ttyname_r.c | 8 ++---
> sysvipc/ftok.c | 2 +-
> time/getdate.c | 2 +-
> time/tzfile.c | 4 +--
> 56 files changed, 108 insertions(+), 113 deletions(-)
>
> diff --git a/catgets/open_catalog.c b/catgets/open_catalog.c
> index 6b14963d78..cf8d635ae7 100644
> --- a/catgets/open_catalog.c
> +++ b/catgets/open_catalog.c
> @@ -194,7 +194,7 @@ __open_catalog (const char *cat_name, const char
> *nlspath, const char *env_var, return -1;
> }
>
> - if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0)
> + if (__builtin_expect (__fstat64 (fd, &st), 0) < 0)
> goto close_unlock_return;
>
> if (__builtin_expect (!S_ISREG (st.st_mode), 0)
> diff --git a/csu/check_fds.c b/csu/check_fds.c
> index 30634b81a7..29d9d04acb 100644
> --- a/csu/check_fds.c
> +++ b/csu/check_fds.c
> @@ -71,7 +71,7 @@ check_one_fd (int fd, int mode)
> decsriptor numbers, in this order. */
> struct stat64 st;
> if (__builtin_expect (nullfd != fd, 0)
> - || __builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0)
> != 0
> + || __builtin_expect (__fstat64 (fd, &st), 0) != 0
> || __builtin_expect (S_ISCHR (st.st_mode), 1) == 0
> || st.st_rdev != dev)
> /* We cannot even give an error message here since it would
> diff --git a/elf/cache.c b/elf/cache.c
> index d92b4e59c1..1eb1455883 100644
> --- a/elf/cache.c
> +++ b/elf/cache.c
> @@ -163,7 +163,7 @@ print_cache (const char *cache_name)
> error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"),
> cache_name);
> struct stat64 st;
> - if (fstat64 (fd, &st) < 0
> + if (__fstat64 (fd, &st) < 0
> /* No need to map the file if it is empty. */
> || st.st_size == 0)
> {
> @@ -699,7 +699,7 @@ load_aux_cache (const char *aux_cache_name)
> }
>
> struct stat64 st;
> - if (fstat64 (fd, &st) < 0 || st.st_size < sizeof (struct
> aux_cache_file))
> + if (__fstat64 (fd, &st) < 0 || st.st_size < sizeof (struct
> aux_cache_file)) {
> close (fd);
> init_aux_cache ();
> diff --git a/elf/dl-load.c b/elf/dl-load.c
> index e39980fb19..646c5dca40 100644
> --- a/elf/dl-load.c
> +++ b/elf/dl-load.c
> @@ -1914,7 +1914,7 @@ open_path (const char *name, size_t namelen,
> int mode,
> buf[buflen - namelen - 1] = '\0';
>
> - if (__xstat64 (_STAT_VER, buf, &st) != 0
> + if (__stat64 (buf, &st) != 0
> || ! S_ISDIR (st.st_mode))
> /* The directory does not exist or it is no
> directory. */ this_dir->status[cnt] = nonexisting;
> @@ -1934,7 +1934,7 @@ open_path (const char *name, size_t namelen,
> int mode, directories and so exploit the bugs. */
> struct stat64 st;
>
> - if (__fxstat64 (_STAT_VER, fd, &st) != 0
> + if (__fstat64 (fd, &st) != 0
> || (st.st_mode & S_ISUID) == 0)
> {
> /* The shared object cannot be tested for being
> SUID diff --git a/elf/dl-misc.c b/elf/dl-misc.c
> index f9d1fd7993..aee62e1e60 100644
> --- a/elf/dl-misc.c
> +++ b/elf/dl-misc.c
> @@ -47,7 +47,7 @@ _dl_sysdep_read_whole_file (const char *file,
> size_t *sizep, int prot) int fd = __open64_nocancel (file, O_RDONLY |
> O_CLOEXEC); if (fd >= 0)
> {
> - if (__fxstat64 (_STAT_VER, fd, &st) >= 0)
> + if (__fstat64 (fd, &st) >= 0)
> {
> *sizep = st.st_size;
>
> diff --git a/elf/dl-profile.c b/elf/dl-profile.c
> index c681f5415c..89dd70ba3b 100644
> --- a/elf/dl-profile.c
> +++ b/elf/dl-profile.c
> @@ -342,7 +342,7 @@ _dl_start_profile (void)
> return;
> }
>
> - if (__fxstat64 (_STAT_VER, fd, &st) < 0 || !S_ISREG (st.st_mode))
> + if (__fstat64 (fd, &st) < 0 || !S_ISREG (st.st_mode))
> {
> /* Not stat'able or not a regular file => don't use it. */
> errstr = "%s: cannot stat file: %s\n";
> diff --git a/iconv/gconv_cache.c b/iconv/gconv_cache.c
> index 9fe371b4c0..b326cd19e2 100644
> --- a/iconv/gconv_cache.c
> +++ b/iconv/gconv_cache.c
> @@ -64,7 +64,7 @@ __gconv_load_cache (void)
> return -1;
>
> /* Get information about the file. */
> - if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0
> + if (__builtin_expect (__fstat64 (fd, &st), 0) < 0
> /* We do not have to start looking at the file if it cannot
> contain at least the cache header. */
> || (size_t) st.st_size < sizeof (struct gconvcache_header))
> diff --git a/include/sys/stat.h b/include/sys/stat.h
> index 92284ca48b..f8847cf73e 100644
> --- a/include/sys/stat.h
> +++ b/include/sys/stat.h
> @@ -53,6 +53,7 @@ extern __typeof (__fxstatat64) __fxstatat64
> attribute_hidden; #define lstat64(fname, buf) __lxstat64 (_STAT_VER,
> fname, buf) #define __lstat64(fname, buf) __lxstat64 (_STAT_VER,
> fname, buf) #define stat64(fname, buf) __xstat64 (_STAT_VER, fname,
> buf) +#define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
> #define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
> #define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
> #define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
> diff --git a/inet/rcmd.c b/inet/rcmd.c
> index 8a9616f847..452ff7d099 100644
> --- a/inet/rcmd.c
> +++ b/inet/rcmd.c
> @@ -474,7 +474,7 @@ iruserfopen (const char *file, uid_t okuser)
> /* If not a regular file, if owned by someone other than user or
> root, if writeable by anyone but the owner, or if hardlinked
> anywhere, quit. */
> - if (__lxstat64 (_STAT_VER, file, &st))
> + if (__lstat64 (file, &st))
> cp = _("lstat failed");
> else if (!S_ISREG (st.st_mode))
> cp = _("not regular file");
> @@ -483,7 +483,7 @@ iruserfopen (const char *file, uid_t okuser)
> res = fopen (file, "rce");
> if (!res)
> cp = _("cannot open");
> - else if (__fxstat64 (_STAT_VER, fileno (res), &st) < 0)
> + else if (__fstat64 (fileno (res), &st) < 0)
> cp = _("fstat failed");
> else if (st.st_uid && st.st_uid != okuser)
> cp = _("bad owner");
> diff --git a/inet/ruserpass.c b/inet/ruserpass.c
> index 4fa6520c1a..d61a72877d 100644
> --- a/inet/ruserpass.c
> +++ b/inet/ruserpass.c
> @@ -174,7 +174,7 @@ next:
> break;
> case PASSWD:
> if (strcmp(*aname, "anonymous") &&
> - fstat64(fileno(cfile), &stb) >= 0 &&
> + __fstat64(fileno(cfile), &stb) >= 0 &&
> (stb.st_mode & 077) != 0) {
> warnx(_("Error: .netrc file is readable by others."));
> warnx(_("Remove 'password' line or make file unreadable by
> others.")); diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
> index 91c1ef156a..d44a4a0b14 100644
> --- a/intl/loadmsgcat.c
> +++ b/intl/loadmsgcat.c
> @@ -804,7 +804,7 @@ _nl_load_domain (struct loaded_l10nfile
> *domain_file, /* We must know about the size of the file. */
> if (
> #ifdef _LIBC
> - __builtin_expect (fstat64 (fd, &st) != 0, 0)
> + __builtin_expect (__fstat64 (fd, &st) != 0, 0)
> #else
> __builtin_expect (fstat (fd, &st) != 0, 0)
> #endif
> diff --git a/io/file_change_detection.c b/io/file_change_detection.c
> index c6d700ed05..f52d8fecfa 100644
> --- a/io/file_change_detection.c
> +++ b/io/file_change_detection.c
> @@ -67,7 +67,7 @@ __file_change_detection_for_path (struct
> file_change_detection *file, const char *path)
> {
> struct stat64 st;
> - if (stat64 (path, &st) != 0)
> + if (__stat64 (path, &st) != 0)
> switch (errno)
> {
> case EACCES:
> @@ -105,7 +105,7 @@ __file_change_detection_for_fp (struct
> file_change_detection *file, else
> {
> struct stat64 st;
> - if (fstat64 (__fileno (fp), &st) != 0)
> + if (__fstat64 (__fileno (fp), &st) != 0)
> /* If we already have a file descriptor, all errors are
> fatal. */ return false;
> else
> diff --git a/io/fts.c b/io/fts.c
> index ba83691859..9668a205c3 100644
> --- a/io/fts.c
> +++ b/io/fts.c
> @@ -81,8 +81,9 @@ static char sccsid[] = "@(#)fts.c 8.6
> (Berkeley) 8/14/94"; # define FTSOBJ FTS
> # define FTSENTRY FTSENT
> # define INO_T ino_t
> -# define STAT stat
> -# define LSTAT lstat
> +# define STRUCT_STAT stat
> +# define STAT __stat
> +# define LSTAT __lstat
> #endif
>
> static FTSENTRY *fts_alloc (FTSOBJ *, const char *, size_t);
> @@ -872,7 +873,7 @@ fts_stat (FTSOBJ *sp, FTSENTRY *p, int follow)
> FTSENTRY *t;
> dev_t dev;
> INO_T ino;
> - struct STAT *sbp, sb;
> + struct STRUCT_STAT *sbp, sb;
> int saved_errno;
>
> /* If user needs stat info, stat buffer already allocated. */
> @@ -906,7 +907,7 @@ fts_stat (FTSOBJ *sp, FTSENTRY *p, int follow)
> }
> } else if (LSTAT(p->fts_accpath, sbp)) {
> p->fts_errno = errno;
> -err: memset(sbp, 0, sizeof(struct STAT));
> +err: memset(sbp, 0, sizeof(struct STRUCT_STAT));
> return (FTS_NS);
> }
>
> @@ -996,7 +997,7 @@ fts_alloc (FTSOBJ *sp, const char *name, size_t
> namelen) */
> len = sizeof(FTSENTRY) + namelen;
> if (!ISSET(FTS_NOSTAT))
> - len += sizeof(struct STAT) + ALIGNBYTES;
> + len += sizeof(struct STRUCT_STAT) + ALIGNBYTES;
> if ((p = malloc(len)) == NULL)
> return (NULL);
>
> @@ -1005,7 +1006,7 @@ fts_alloc (FTSOBJ *sp, const char *name, size_t
> namelen) p->fts_name[namelen] = '\0';
>
> if (!ISSET(FTS_NOSTAT))
> - p->fts_statp = (struct STAT *)ALIGN(p->fts_name +
> namelen + 2);
> + p->fts_statp = (struct STRUCT_STAT
> *)ALIGN(p->fts_name + namelen + 2); p->fts_namelen = namelen;
> p->fts_path = sp->fts_path;
> p->fts_errno = 0;
> @@ -1116,7 +1117,7 @@ fts_safe_changedir (FTSOBJ *sp, FTSENTRY *p,
> int fd, const char *path) return (0);
> if (fd < 0 && (newfd = __open(path, O_RDONLY, 0)) < 0)
> return (-1);
> - if (__fxstat64(_STAT_VER, newfd, &sb)) {
> + if (__fstat64(newfd, &sb)) {
> ret = -1;
> goto bail;
> }
> diff --git a/io/fts64.c b/io/fts64.c
> index 3d9c779791..466703da37 100644
> --- a/io/fts64.c
> +++ b/io/fts64.c
> @@ -24,7 +24,8 @@
> #define FTSOBJ FTS64
> #define FTSENTRY FTSENT64
> #define INO_T ino64_t
> -#define STAT stat64
> -#define LSTAT lstat64
> +#define STRUCT_STAT stat64
> +#define STAT __stat64
> +#define LSTAT __lstat64
>
> #include "fts.c"
> diff --git a/io/ftw.c b/io/ftw.c
> index 8c79d29a9e..7104816e85 100644
> --- a/io/ftw.c
> +++ b/io/ftw.c
> @@ -135,15 +135,15 @@ int rpl_lstat (const char *, struct stat *);
> # define NFTW_OLD_NAME __old_nftw
> # define NFTW_NEW_NAME __new_nftw
> # define INO_T ino_t
> -# define STAT stat
> +# define STRUCT_STAT stat
> # ifdef _LIBC
> -# define LXSTAT __lxstat
> -# define XSTAT __xstat
> -# define FXSTATAT __fxstatat
> +# define LSTAT __lstat
> +# define STAT __stat
> +# define FSTATAT __fstatat
> # else
> -# define LXSTAT(V,f,sb) lstat (f,sb)
> -# define XSTAT(V,f,sb) stat (f,sb)
> -# define FXSTATAT(V,d,f,sb,m) fstatat (d, f, sb, m)
> +# define LSTAT lstat
> +# define XTAT stat
> +# define FSTATAT fstatat
> # endif
> # define FTW_FUNC_T __ftw_func_t
> # define NFTW_FUNC_T __nftw_func_t
> @@ -219,7 +219,7 @@ static const int ftw_arr[] =
>
>
> /* Forward declarations of local functions. */
> -static int ftw_dir (struct ftw_data *data, struct STAT *st,
> +static int ftw_dir (struct ftw_data *data, struct STRUCT_STAT *st,
> struct dir_data *old_dir);
>
>
> @@ -239,7 +239,7 @@ object_compare (const void *p1, const void *p2)
>
>
> static int
> -add_object (struct ftw_data *data, struct STAT *st)
> +add_object (struct ftw_data *data, struct STRUCT_STAT *st)
> {
> struct known_object *newp = malloc (sizeof (struct known_object));
> if (newp == NULL)
> @@ -251,7 +251,7 @@ add_object (struct ftw_data *data, struct STAT
> *st)
>
> static inline int
> -find_object (struct ftw_data *data, struct STAT *st)
> +find_object (struct ftw_data *data, struct STRUCT_STAT *st)
> {
> struct known_object obj;
> obj.dev = st->st_dev;
> @@ -378,7 +378,7 @@ static int
> process_entry (struct ftw_data *data, struct dir_data *dir, const
> char *name, size_t namlen, int d_type)
> {
> - struct STAT st;
> + struct STRUCT_STAT st;
> int result = 0;
> int flag = 0;
> size_t new_buflen;
> @@ -405,16 +405,16 @@ process_entry (struct ftw_data *data, struct
> dir_data *dir, const char *name,
> int statres;
> if (dir->streamfd != -1)
> - statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st,
> - (data->flags & FTW_PHYS) ?
> AT_SYMLINK_NOFOLLOW : 0);
> + statres = FSTATAT (dir->streamfd, name, &st,
> + (data->flags & FTW_PHYS) ?
> AT_SYMLINK_NOFOLLOW : 0); else
> {
> if ((data->flags & FTW_CHDIR) == 0)
> name = data->dirbuf;
>
> statres = ((data->flags & FTW_PHYS)
> - ? LXSTAT (_STAT_VER, name, &st)
> - : XSTAT (_STAT_VER, name, &st));
> + ? LSTAT (name, &st)
> + : STAT (name, &st));
> }
>
> if (statres < 0)
> @@ -430,10 +430,10 @@ process_entry (struct ftw_data *data, struct
> dir_data *dir, const char *name, it should contain information about
> the link (ala lstat). We do our best to fill in what data we can. */
> if (dir->streamfd != -1)
> - statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st,
> - AT_SYMLINK_NOFOLLOW);
> + statres = FSTATAT (dir->streamfd, name, &st,
> + AT_SYMLINK_NOFOLLOW);
> else
> - statres = LXSTAT (_STAT_VER, name, &st);
> + statres = LSTAT (name, &st);
> if (statres == 0 && S_ISLNK (st.st_mode))
> flag = FTW_SLN;
> else
> @@ -476,7 +476,7 @@ process_entry (struct ftw_data *data, struct
> dir_data *dir, const char *name,
> static int
> __attribute ((noinline))
> -ftw_dir (struct ftw_data *data, struct STAT *st, struct dir_data
> *old_dir) +ftw_dir (struct ftw_data *data, struct STRUCT_STAT *st,
> struct dir_data *old_dir) {
> struct dir_data dir;
> struct dirent64 *d;
> @@ -630,7 +630,7 @@ ftw_startup (const char *dir, int is_nftw, void
> *func, int descriptors, int flags)
> {
> struct ftw_data data;
> - struct STAT st;
> + struct STRUCT_STAT st;
> int result = 0;
> int save_err;
> int cwdfd = -1;
> @@ -740,12 +740,12 @@ ftw_startup (const char *dir, int is_nftw, void
> *func, int descriptors, name = data.dirbuf;
>
> if (((flags & FTW_PHYS)
> - ? LXSTAT (_STAT_VER, name, &st)
> - : XSTAT (_STAT_VER, name, &st)) < 0)
> + ? LSTAT (name, &st)
> + : STAT (name, &st)) < 0)
> {
> if (!(flags & FTW_PHYS)
> && errno == ENOENT
> - && LXSTAT (_STAT_VER, name, &st) == 0
> + && LSTAT (name, &st) == 0
> && S_ISLNK (st.st_mode))
> result = (*data.func) (data.dirbuf, &st,
> data.cvt_arr[FTW_SLN], &data.ftw);
> diff --git a/io/ftw64.c b/io/ftw64.c
> index 20c43d9616..8daf8777cf 100644
> --- a/io/ftw64.c
> +++ b/io/ftw64.c
> @@ -22,10 +22,10 @@
> #define NFTW_OLD_NAME __old_nftw64
> #define NFTW_NEW_NAME __new_nftw64
> #define INO_T ino64_t
> -#define STAT stat64
> -#define LXSTAT __lxstat64
> -#define XSTAT __xstat64
> -#define FXSTATAT __fxstatat64
> +#define STRUCT_STAT stat64
> +#define LSTAT __lstat64
> +#define STAT __stat64
> +#define FSTATAT __fstatat64
> #define FTW_FUNC_T __ftw64_func_t
> #define NFTW_FUNC_T __nftw64_func_t
>
> diff --git a/io/getdirname.c b/io/getdirname.c
> index dd69e4e281..2465b62ad2 100644
> --- a/io/getdirname.c
> +++ b/io/getdirname.c
> @@ -32,8 +32,8 @@ get_current_dir_name (void)
>
> pwd = getenv ("PWD");
> if (pwd != NULL
> - && stat64 (".", &dotstat) == 0
> - && stat64 (pwd, &pwdstat) == 0
> + && __stat64 (".", &dotstat) == 0
> + && __stat64 (pwd, &pwdstat) == 0
> && pwdstat.st_dev == dotstat.st_dev
> && pwdstat.st_ino == dotstat.st_ino)
> /* The PWD value is correct. Use it. */
> diff --git a/io/mkdirat.c b/io/mkdirat.c
> index cfe01b5748..094f0d7e0e 100644
> --- a/io/mkdirat.c
> +++ b/io/mkdirat.c
> @@ -36,7 +36,7 @@ mkdirat (int fd, const char *path, mode_t mode)
> {
> /* Check FD is associated with a directory. */
> struct stat64 st;
> - if (__fxstat64 (_STAT_VER, fd, &st) != 0)
> + if (__fstat64 (fd, &st) != 0)
> return -1;
>
> if (!S_ISDIR (st.st_mode))
> diff --git a/io/mkfifoat.c b/io/mkfifoat.c
> index 409f55112c..f2af653399 100644
> --- a/io/mkfifoat.c
> +++ b/io/mkfifoat.c
> @@ -37,7 +37,7 @@ mkfifoat (int fd, const char *path, mode_t mode)
> {
> /* Check FD is associated with a directory. */
> struct stat64 st;
> - if (__fxstat64 (_STAT_VER, fd, &st) != 0)
> + if (__fstat64 (fd, &st) != 0)
> return -1;
>
> if (!S_ISDIR (st.st_mode))
> diff --git a/io/openat.c b/io/openat.c
> index a7ce65bee2..a2e86eddeb 100644
> --- a/io/openat.c
> +++ b/io/openat.c
> @@ -47,7 +47,7 @@ __openat (int fd, const char *file, int oflag, ...)
> {
> /* Check FD is associated with a directory. */
> struct stat64 st;
> - if (__fxstat64 (_STAT_VER, fd, &st) != 0)
> + if (__fstat64 (fd, &st) != 0)
> return -1;
>
> if (!S_ISDIR (st.st_mode))
> diff --git a/io/openat64.c b/io/openat64.c
> index b66979c035..a4bb188eb2 100644
> --- a/io/openat64.c
> +++ b/io/openat64.c
> @@ -40,7 +40,7 @@ __openat64 (int fd, const char *file, int oflag,
> ...) {
> /* Check FD is associated with a directory. */
> struct stat64 st;
> - if (__fxstat64 (_STAT_VER, fd, &st) != 0)
> + if (__fstat64 (fd, &st) != 0)
> return -1;
>
> if (!S_ISDIR (st.st_mode))
> diff --git a/io/xmknodat.c b/io/xmknodat.c
> index 0e69db1940..b6c668170b 100644
> --- a/io/xmknodat.c
> +++ b/io/xmknodat.c
> @@ -44,7 +44,7 @@ __xmknodat (int vers, int fd, const char *path,
> mode_t mode, dev_t *dev) {
> /* Check FD is associated with a directory. */
> struct stat64 st;
> - if (__fxstat64 (_STAT_VER, fd, &st) != 0)
> + if (__fstat64 (fd, &st) != 0)
> return -1;
>
> if (!S_ISDIR (st.st_mode))
> diff --git a/libio/fileops.c b/libio/fileops.c
> index bc76f3549f..99f06efc10 100644
> --- a/libio/fileops.c
> +++ b/libio/fileops.c
> @@ -1145,7 +1145,7 @@ libc_hidden_def (_IO_file_seek)
> int
> _IO_file_stat (FILE *fp, void *st)
> {
> - return __fxstat64 (_STAT_VER, fp->_fileno, (struct stat64 *) st);
> + return __fstat64 (fp->_fileno, (struct stat64 *) st);
> }
> libc_hidden_def (_IO_file_stat)
>
> diff --git a/locale/loadarchive.c b/locale/loadarchive.c
> index ba0fe45648..8de6a327a4 100644
> --- a/locale/loadarchive.c
> +++ b/locale/loadarchive.c
> @@ -207,7 +207,7 @@ _nl_load_locale_from_archive (int category, const
> char **namep) /* Cannot open the archive, for whatever reason. */
> return NULL;
>
> - if (__fxstat64 (_STAT_VER, fd, &archive_stat) == -1)
> + if (__fstat64 (fd, &archive_stat) == -1)
> {
> /* stat failed, very strange. */
> close_and_out:
> @@ -405,7 +405,7 @@ _nl_load_locale_from_archive (int category, const
> char **namep) /* Now verify we think this is really the same archive
> file we opened before. If it has been changed we cannot trust
> the header we read previously. */
> - if (__fxstat64 (_STAT_VER, fd, &st) < 0
> + if (__fstat64 (fd, &st) < 0
> || st.st_size != archive_stat.st_size
> || st.st_mtime != archive_stat.st_mtime
> || st.st_dev != archive_stat.st_dev
> diff --git a/locale/loadlocale.c b/locale/loadlocale.c
> index 2fcb348d1d..82c745d9a2 100644
> --- a/locale/loadlocale.c
> +++ b/locale/loadlocale.c
> @@ -180,7 +180,7 @@ _nl_load_locale (struct loaded_l10nfile *file,
> int category) /* Cannot open the file. */
> return;
>
> - if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0)
> + if (__builtin_expect (__fstat64 (fd, &st), 0) < 0)
> {
> puntfd:
> __close_nocancel_nostatus (fd);
> @@ -206,7 +206,7 @@ _nl_load_locale (struct loaded_l10nfile *file,
> int category) if (__builtin_expect (fd, 0) < 0)
> return;
>
> - if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0)
> + if (__builtin_expect (__fstat64 (fd, &st), 0) < 0)
> goto puntfd;
> }
>
> diff --git a/misc/daemon.c b/misc/daemon.c
> index 21e785966a..0e688f4d74 100644
> --- a/misc/daemon.c
> +++ b/misc/daemon.c
> @@ -64,7 +64,7 @@ daemon (int nochdir, int noclose)
> struct stat64 st;
>
> if ((fd = __open_nocancel(_PATH_DEVNULL, O_RDWR, 0))
> != -1
> - && (__builtin_expect (__fxstat64 (_STAT_VER, fd,
> &st), 0)
> + && (__builtin_expect (__fstat64 (fd, &st), 0)
> == 0)) {
> if (__builtin_expect (S_ISCHR (st.st_mode),
> 1) != 0 #if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR
> diff --git a/misc/getusershell.c b/misc/getusershell.c
> index fc2c43b771..11f5aa83f8 100644
> --- a/misc/getusershell.c
> +++ b/misc/getusershell.c
> @@ -106,7 +106,7 @@ initshells (void)
> strings = NULL;
> if ((fp = fopen(_PATH_SHELLS, "rce")) == NULL)
> goto init_okshells_noclose;
> - if (fstat64(fileno(fp), &statb) == -1) {
> + if (__fstat64(fileno(fp), &statb) == -1) {
> init_okshells:
> (void)fclose(fp);
> init_okshells_noclose:
> diff --git a/nptl/sem_open.c b/nptl/sem_open.c
> index b022cbfd9a..05e286002b 100644
> --- a/nptl/sem_open.c
> +++ b/nptl/sem_open.c
> @@ -68,7 +68,7 @@ check_add_mapping (const char *name, size_t
> namelen, int fd, sem_t *existing)
> /* Get the information about the file. */
> struct stat64 st;
> - if (__fxstat64 (_STAT_VER, fd, &st) == 0)
> + if (__fstat64 (fd, &st) == 0)
> {
> /* Get the lock. */
> lll_lock (__sem_mappings_lock, LLL_PRIVATE);
> diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
> index a4f3312f90..41c7937fcd 100644
> --- a/nscd/nscd_helper.c
> +++ b/nscd/nscd_helper.c
> @@ -325,7 +325,7 @@ __nscd_get_mapping (request_type type, const char
> *key, if (__glibc_unlikely (n == keylen))
> {
> struct stat64 st;
> - if (__builtin_expect (fstat64 (mapfd, &st) != 0, 0)
> + if (__builtin_expect (__fstat64 (mapfd, &st) != 0, 0)
> || __builtin_expect (st.st_size < sizeof (struct
> database_pers_head), 0))
> goto out_close;
> diff --git a/posix/glob.c b/posix/glob.c
> index 4580cefb9f..b4b34945e2 100644
> --- a/posix/glob.c
> +++ b/posix/glob.c
> @@ -49,12 +49,6 @@
> # define readdir(str) __readdir64 (str)
> # define getpwnam_r(name, bufp, buf, len, res) \
> __getpwnam_r (name, bufp, buf, len, res)
> -# ifndef __lstat64
> -# define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
> -# endif
> -# ifndef __stat64
> -# define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
> -# endif
> # define struct_stat64 struct stat64
> # define FLEXIBLE_ARRAY_MEMBER
> # include <shlib-compat.h>
> @@ -63,7 +57,6 @@
> # define __getlogin_r(buf, len) getlogin_r (buf, len)
> # define __lstat64(fname, buf) lstat (fname, buf)
> # define __stat64(fname, buf) stat (fname, buf)
> -# define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag)
> # define struct_stat64 struct stat
> # ifndef __MVS__
> # define __alloca alloca
> diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
> index cbd885a3c5..3fcb399a5d 100644
> --- a/stdlib/canonicalize.c
> +++ b/stdlib/canonicalize.c
> @@ -158,7 +158,7 @@ __realpath (const char *name, char *resolved)
> dest = __mempcpy (dest, start, end - start);
> *dest = '\0';
>
> - if (__lxstat64 (_STAT_VER, rpath, &st) < 0)
> + if (__lstat64 (rpath, &st) < 0)
> goto error;
>
> if (S_ISLNK (st.st_mode))
> diff --git a/sysdeps/gnu/glob64-lstat-compat.c
> b/sysdeps/gnu/glob64-lstat-compat.c index 47b5e88498..ac1fe1496a
> 100644 --- a/sysdeps/gnu/glob64-lstat-compat.c
> +++ b/sysdeps/gnu/glob64-lstat-compat.c
> @@ -32,7 +32,7 @@
> #undef stat
> #define stat stat64
> #undef __stat
> -#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
> +#define __stat(file, buf) __stat64 (file, buf)
>
> #define COMPILE_GLOB64 1
>
> diff --git a/sysdeps/gnu/glob64.c b/sysdeps/gnu/glob64.c
> index 42b5b225ca..32ac018fde 100644
> --- a/sysdeps/gnu/glob64.c
> +++ b/sysdeps/gnu/glob64.c
> @@ -12,7 +12,7 @@
> #undef stat
> #define stat stat64
> #undef __stat
> -#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
> +#define __stat(file, buf) __stat64 (file, buf)
>
> #define COMPILE_GLOB64 1
>
> diff --git a/sysdeps/mach/hurd/ptsname.c b/sysdeps/mach/hurd/ptsname.c
> index 9627f970f9..065ba2a268 100644
> --- a/sysdeps/mach/hurd/ptsname.c
> +++ b/sysdeps/mach/hurd/ptsname.c
> @@ -63,7 +63,7 @@ __ptsname_internal (int fd, char *buf, size_t
> buflen, struct stat64 *stp)
> if (stp)
> {
> - if (__xstat64 (_STAT_VER, peername, stp) < 0)
> + if (__stat64 (peername, stp) < 0)
> return errno;
> }
>
> diff --git a/sysdeps/posix/dl-fileid.h b/sysdeps/posix/dl-fileid.h
> index 7d1e9e4950..b3c8166701 100644
> --- a/sysdeps/posix/dl-fileid.h
> +++ b/sysdeps/posix/dl-fileid.h
> @@ -34,7 +34,7 @@ _dl_get_file_id (int fd, struct r_file_id *id)
> {
> struct stat64 st;
>
> - if (__glibc_unlikely (__fxstat64 (_STAT_VER, fd, &st) < 0))
> + if (__glibc_unlikely (__fstat64 (fd, &st) < 0))
> return false;
>
> id->dev = st.st_dev;
> diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c
> index 8a2776d502..050d370f4c 100644
> --- a/sysdeps/posix/euidaccess.c
> +++ b/sysdeps/posix/euidaccess.c
> @@ -140,7 +140,7 @@ euidaccess (const char *path, int mode)
> return access (path, mode);
> #endif
>
> - if (stat64 (path, &stats))
> + if (__stat64 (path, &stats))
> return -1;
>
> mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */
> diff --git a/sysdeps/posix/fdopendir.c b/sysdeps/posix/fdopendir.c
> index b690f7fc88..e424fbdaa2 100644
> --- a/sysdeps/posix/fdopendir.c
> +++ b/sysdeps/posix/fdopendir.c
> @@ -29,7 +29,7 @@ __fdopendir (int fd)
> {
> struct stat64 statbuf;
>
> - if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
> + if (__builtin_expect (__fstat64 (fd, &statbuf), 0) < 0)
> return NULL;
> if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
> {
> diff --git a/sysdeps/posix/fpathconf.c b/sysdeps/posix/fpathconf.c
> index 1863be64e0..3a9fb1513f 100644
> --- a/sysdeps/posix/fpathconf.c
> +++ b/sysdeps/posix/fpathconf.c
> @@ -133,7 +133,7 @@ __fpathconf (int fd, int name)
> /* AIO is only allowed on regular files and block devices.
> */ struct stat64 st;
>
> - if (__fxstat64 (_STAT_VER, fd, &st) < 0
> + if (__fstat64 (fd, &st) < 0
> || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode)))
> return -1;
> else
> diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
> index ed04e564f9..82c898fe35 100644
> --- a/sysdeps/posix/getaddrinfo.c
> +++ b/sysdeps/posix/getaddrinfo.c
> @@ -1785,7 +1785,7 @@ gaiconf_init (void)
> if (fp != NULL)
> {
> struct stat64 st;
> - if (__fxstat64 (_STAT_VER, fileno (fp), &st) != 0)
> + if (__fstat64 (fileno (fp), &st) != 0)
> {
> fclose (fp);
> goto no_file;
> @@ -2138,7 +2138,7 @@ static void
> gaiconf_reload (void)
> {
> struct stat64 st;
> - if (__xstat64 (_STAT_VER, GAICONF_FNAME, &st) != 0
> + if (stat64 (GAICONF_FNAME, &st) != 0
> || !check_gaiconf_mtime (&st))
> gaiconf_init ();
> }
> diff --git a/sysdeps/posix/isfdtype.c b/sysdeps/posix/isfdtype.c
> index 20c6309220..3c63a33e88 100644
> --- a/sysdeps/posix/isfdtype.c
> +++ b/sysdeps/posix/isfdtype.c
> @@ -29,7 +29,7 @@ isfdtype (int fildes, int fdtype)
>
> {
> int save_error = errno;
> - result = fstat64 (fildes, &st);
> + result = __fstat64 (fildes, &st);
> __set_errno (save_error);
> }
>
> diff --git a/sysdeps/posix/opendir.c b/sysdeps/posix/opendir.c
> index c6ab79246c..e89e09bfc7 100644
> --- a/sysdeps/posix/opendir.c
> +++ b/sysdeps/posix/opendir.c
> @@ -56,7 +56,7 @@ opendir_tail (int fd)
> `stat' call. The S_ISDIR check is superfluous if O_DIRECTORY
> works, but it's cheap and we need the stat call for st_blksize
> anyway. */ struct stat64 statbuf;
> - if (__glibc_unlikely (__fxstat64 (_STAT_VER, fd, &statbuf) < 0))
> + if (__glibc_unlikely (__fstat64 (fd, &statbuf) < 0))
> goto lose;
> if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
> {
> diff --git a/sysdeps/posix/pathconf.c b/sysdeps/posix/pathconf.c
> index 5819f03aa7..084c5fab59 100644
> --- a/sysdeps/posix/pathconf.c
> +++ b/sysdeps/posix/pathconf.c
> @@ -131,7 +131,7 @@ __pathconf (const char *path, int name)
> /* AIO is only allowed on regular files and block devices.
> */ struct stat64 st;
>
> - if (__xstat64 (_STAT_VER, path, &st) < 0
> + if (__stat64 (path, &st) < 0
> || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode)))
> return -1;
> else
> diff --git a/sysdeps/posix/posix_fallocate.c
> b/sysdeps/posix/posix_fallocate.c index e7fccfc1c8..c9cf17bc7b 100644
> --- a/sysdeps/posix/posix_fallocate.c
> +++ b/sysdeps/posix/posix_fallocate.c
> @@ -48,7 +48,7 @@ posix_fallocate (int fd, __off_t offset, __off_t
> len) }
>
> /* We have to make sure that this is really a regular file. */
> - if (__fxstat64 (_STAT_VER, fd, &st) != 0)
> + if (__fstat64 (fd, &st) != 0)
> return EBADF;
> if (S_ISFIFO (st.st_mode))
> return ESPIPE;
> diff --git a/sysdeps/posix/posix_fallocate64.c
> b/sysdeps/posix/posix_fallocate64.c index f9d4fe5ca3..4f8fe47b18
> 100644 --- a/sysdeps/posix/posix_fallocate64.c
> +++ b/sysdeps/posix/posix_fallocate64.c
> @@ -48,7 +48,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset,
> __off64_t len) }
>
> /* We have to make sure that this is really a regular file. */
> - if (__fxstat64 (_STAT_VER, fd, &st) != 0)
> + if (__fstat64 (fd, &st) != 0)
> return EBADF;
> if (S_ISFIFO (st.st_mode))
> return ESPIPE;
> diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c
> index 35ba7f8103..8f7c4708df 100644
> --- a/sysdeps/posix/sysconf.c
> +++ b/sysdeps/posix/sysconf.c
> @@ -1216,7 +1216,7 @@ __sysconf_check_spec (const char *spec)
> spec, speclen + 1);
>
> struct stat64 st;
> - long int ret = __xstat64 (_STAT_VER, name, &st) >= 0 ? 1 : -1;
> + long int ret = __stat64 (name, &st) >= 0 ? 1 : -1;
>
> __set_errno (save_errno);
> return ret;
> diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
> index cd48385a40..3dd8f1e1ef 100644
> --- a/sysdeps/posix/tempname.c
> +++ b/sysdeps/posix/tempname.c
> @@ -65,7 +65,6 @@
> # define __getpid getpid
> # define __mkdir mkdir
> # define __open open
> -# define __lxstat64(version, file, buf) lstat (file, buf)
> # define __secure_getenv secure_getenv
> #endif
>
> @@ -96,7 +95,7 @@ static int
> direxists (const char *dir)
> {
> struct_stat64 buf;
> - return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR
> (buf.st_mode);
> + return __stat64 (dir, &buf) == 0 && S_ISDIR (buf.st_mode);
> }
>
> /* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
> @@ -254,7 +253,7 @@ __gen_tempname (char *tmpl, int suffixlen, int
> flags, int kind) succeeds if __xstat fails because the name does not
> exist. Note the continue to bypass the common logic at the bottom
> of the loop. */
> - if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
> + if (__lstat64 (tmpl, &st) < 0)
> {
> if (errno == ENOENT)
> {
> diff --git a/sysdeps/unix/sysv/linux/faccessat.c
> b/sysdeps/unix/sysv/linux/faccessat.c index e4f18ab2db..5a660f5201
> 100644 --- a/sysdeps/unix/sysv/linux/faccessat.c
> +++ b/sysdeps/unix/sysv/linux/faccessat.c
> @@ -37,7 +37,7 @@ faccessat (int fd, const char *file, int mode, int
> flag) return INLINE_SYSCALL (faccessat, 3, fd, file, mode);
>
> struct stat64 stats;
> - if (__fxstatat64 (_STAT_VER, fd, file, &stats, flag &
> AT_SYMLINK_NOFOLLOW))
> + if (__fstatat64 (fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW))
> return -1;
>
> mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */
> diff --git a/sysdeps/unix/sysv/linux/fexecve.c
> b/sysdeps/unix/sysv/linux/fexecve.c index 23c9799f5d..1fe3a23333
> 100644 --- a/sysdeps/unix/sysv/linux/fexecve.c
> +++ b/sysdeps/unix/sysv/linux/fexecve.c
> @@ -60,8 +60,8 @@ fexecve (int fd, char *const argv[], char *const
> envp[])
> /* We come here only if the 'execve' call fails. Determine whether
> /proc is mounted. If not we return ENOSYS. */
> - struct stat st;
> - if (stat ("/proc/self/fd", &st) != 0 && errno == ENOENT)
> + struct stat64 st;
> + if (__stat64 ("/proc/self/fd", &st) != 0 && errno == ENOENT)
> save = ENOSYS;
>
> __set_errno (save);
> diff --git a/sysdeps/unix/sysv/linux/oldglob.c
> b/sysdeps/unix/sysv/linux/oldglob.c index a034c2d930..59bf89dc1d
> 100644 --- a/sysdeps/unix/sysv/linux/oldglob.c
> +++ b/sysdeps/unix/sysv/linux/oldglob.c
> @@ -31,7 +31,7 @@ libc_hidden_proto (__old_glob64);
> #undef stat
> #define stat stat64
> #undef __stat
> -#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
> +#define __stat(file, buf) __stat64 (file, buf)
>
> /* Avoid calling gl_lstat with GLOB_ALTDIRFUNC. */
> #define GLOB_NO_LSTAT
> diff --git a/sysdeps/unix/sysv/linux/pathconf.c
> b/sysdeps/unix/sysv/linux/pathconf.c index fec1a142e7..e59b8ab341
> 100644 --- a/sysdeps/unix/sysv/linux/pathconf.c
> +++ b/sysdeps/unix/sysv/linux/pathconf.c
> @@ -67,7 +67,7 @@ distinguish_extX (const struct statfs *fsbuf, const
> char *file, int fd) char path[PATH_MAX];
> struct stat64 st;
>
> - if ((file == NULL ? fstat64 (fd, &st) : stat64 (file, &st)) != 0)
> + if ((file == NULL ? __fstat64 (fd, &st) : __stat64 (file, &st)) !=
> 0) /* Strange. The statfd call worked, but stat fails. Default to
> the more pessimistic value. */
> return EXT2_LINK_MAX;
> @@ -110,7 +110,7 @@ distinguish_extX (const struct statfs *fsbuf,
> const char *file, int fd) continue;
>
> struct stat64 fsst;
> - if (stat64 (mntbuf.mnt_dir, &fsst) >= 0
> + if (__stat64 (mntbuf.mnt_dir, &fsst) >= 0
> && st.st_dev == fsst.st_dev)
> {
> if (strcmp (mntbuf.mnt_type, "ext4") == 0)
> diff --git a/sysdeps/unix/sysv/linux/ptsname.c
> b/sysdeps/unix/sysv/linux/ptsname.c index 81d9d26f1e..4c569bf264
> 100644 --- a/sysdeps/unix/sysv/linux/ptsname.c
> +++ b/sysdeps/unix/sysv/linux/ptsname.c
> @@ -114,7 +114,7 @@ __ptsname_internal (int fd, char *buf, size_t
> buflen, struct stat64 *stp) return ERANGE;
> }
>
> - if (__fxstat64 (_STAT_VER, fd, stp) < 0)
> + if (__fstat64 (fd, stp) < 0)
> return errno;
>
> /* Check if FD really is a master pseudo terminal. */
> @@ -138,7 +138,7 @@ __ptsname_internal (int fd, char *buf, size_t
> buflen, struct stat64 *stp) p[2] = '\0';
> }
>
> - if (__xstat64 (_STAT_VER, buf, stp) < 0)
> + if (__stat64 (buf, stp) < 0)
> return errno;
>
> /* Check if the name we're about to return really corresponds to a
> diff --git a/sysdeps/unix/sysv/linux/ttyname.c
> b/sysdeps/unix/sysv/linux/ttyname.c index c05ca687f5..5fa6645353
> 100644 --- a/sysdeps/unix/sysv/linux/ttyname.c
> +++ b/sysdeps/unix/sysv/linux/ttyname.c
> @@ -84,7 +84,7 @@ getttyname (const char *dev, const struct stat64
> *mytty, int save, int *dostat) *((char *) __mempcpy (getttyname_name,
> dev, devlen - 1)) = '/'; }
> memcpy (&getttyname_name[devlen], d->d_name, dlen);
> - if (__xstat64 (_STAT_VER, getttyname_name, &st) == 0
> + if (__stat64 (getttyname_name, &st) == 0
> && is_mytty (mytty, &st))
> {
> (void) __closedir (dirstream);
> @@ -125,7 +125,7 @@ ttyname (int fd)
> if (__glibc_unlikely (__tcgetattr (fd, &term) < 0))
> return NULL;
>
> - if (__fxstat64 (_STAT_VER, fd, &st) < 0)
> + if (__fstat64 (fd, &st) < 0)
> return NULL;
>
> /* We try using the /proc filesystem. */
> @@ -162,14 +162,14 @@ ttyname (int fd)
>
> /* Verify readlink result, fall back on iterating through
> devices. */ if (ttyname_buf[0] == '/'
> - && __xstat64 (_STAT_VER, ttyname_buf, &st1) == 0
> + && __stat64 (ttyname_buf, &st1) == 0
> && is_mytty (&st, &st1))
> return ttyname_buf;
>
> doispty = 1;
> }
>
> - if (__xstat64 (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR
> (st1.st_mode))
> + if (__stat64 ("/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
> {
> name = getttyname ("/dev/pts", &st, save, &dostat);
> }
> diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c
> b/sysdeps/unix/sysv/linux/ttyname_r.c index 4a1ae40bb2..ad8cd28158
> 100644 --- a/sysdeps/unix/sysv/linux/ttyname_r.c
> +++ b/sysdeps/unix/sysv/linux/ttyname_r.c
> @@ -71,7 +71,7 @@ getttyname_r (char *buf, size_t buflen, const
> struct stat64 *mytty, cp = __stpncpy (buf + devlen, d->d_name,
> needed); cp[0] = '\0';
>
> - if (__xstat64 (_STAT_VER, buf, &st) == 0
> + if (__stat64 (buf, &st) == 0
> && is_mytty (mytty, &st))
> {
> (void) __closedir (dirstream);
> @@ -118,7 +118,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
> if (__glibc_unlikely (__tcgetattr (fd, &term) < 0))
> return errno;
>
> - if (__fxstat64 (_STAT_VER, fd, &st) < 0)
> + if (__fstat64 (fd, &st) < 0)
> return errno;
>
> /* We try using the /proc filesystem. */
> @@ -146,7 +146,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
>
> /* Verify readlink result, fall back on iterating through
> devices. */ if (buf[0] == '/'
> - && __xstat64 (_STAT_VER, buf, &st1) == 0
> + && __stat64 (buf, &st1) == 0
> && is_mytty (&st, &st1))
> return 0;
>
> @@ -157,7 +157,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
> memcpy (buf, "/dev/pts/", sizeof ("/dev/pts/"));
> buflen -= sizeof ("/dev/pts/") - 1;
>
> - if (__xstat64 (_STAT_VER, buf, &st1) == 0 && S_ISDIR (st1.st_mode))
> + if (__stat64 (buf, &st1) == 0 && S_ISDIR (st1.st_mode))
> {
> ret = getttyname_r (buf, buflen, &st, save,
> &dostat);
> diff --git a/sysvipc/ftok.c b/sysvipc/ftok.c
> index 0b6dab403f..a65dbd520a 100644
> --- a/sysvipc/ftok.c
> +++ b/sysvipc/ftok.c
> @@ -25,7 +25,7 @@ ftok (const char *pathname, int proj_id)
> struct stat64 st;
> key_t key;
>
> - if (__xstat64 (_STAT_VER, pathname, &st) < 0)
> + if (__stat64 (pathname, &st) < 0)
> return (key_t) -1;
>
> key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16)
> diff --git a/time/getdate.c b/time/getdate.c
> index d5c01b8446..ddd97ba277 100644
> --- a/time/getdate.c
> +++ b/time/getdate.c
> @@ -121,7 +121,7 @@ __getdate_r (const char *string, struct tm *tp)
> if (datemsk == NULL || *datemsk == '\0')
> return 1;
>
> - if (stat64 (datemsk, &st) < 0)
> + if (__stat64 (datemsk, &st) < 0)
> return 3;
>
> if (!S_ISREG (st.st_mode))
> diff --git a/time/tzfile.c b/time/tzfile.c
> index af6da1bf00..e8084a86e8 100644
> --- a/time/tzfile.c
> +++ b/time/tzfile.c
> @@ -152,7 +152,7 @@ __tzfile_read (const char *file, size_t extra,
> char **extrap) /* If we were already using tzfile, check whether the
> file changed. */ struct stat64 st;
> if (was_using_tzfile
> - && stat64 (file, &st) == 0
> + && __stat64 (file, &st) == 0
> && tzfile_ino == st.st_ino && tzfile_dev == st.st_dev
> && tzfile_mtime == st.st_mtime)
> goto done; /* Nothing to do. */
> @@ -164,7 +164,7 @@ __tzfile_read (const char *file, size_t extra,
> char **extrap) goto ret_free_transitions;
>
> /* Get information about the file we are actually using. */
> - if (fstat64 (__fileno (f), &st) != 0)
> + if (__fstat64 (__fileno (f), &st) != 0)
> goto lose;
>
> free ((void *) transitions);
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
@@ -194,7 +194,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
return -1;
}
- if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0)
+ if (__builtin_expect (__fstat64 (fd, &st), 0) < 0)
goto close_unlock_return;
if (__builtin_expect (!S_ISREG (st.st_mode), 0)
@@ -71,7 +71,7 @@ check_one_fd (int fd, int mode)
decsriptor numbers, in this order. */
struct stat64 st;
if (__builtin_expect (nullfd != fd, 0)
- || __builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) != 0
+ || __builtin_expect (__fstat64 (fd, &st), 0) != 0
|| __builtin_expect (S_ISCHR (st.st_mode), 1) == 0
|| st.st_rdev != dev)
/* We cannot even give an error message here since it would
@@ -163,7 +163,7 @@ print_cache (const char *cache_name)
error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"), cache_name);
struct stat64 st;
- if (fstat64 (fd, &st) < 0
+ if (__fstat64 (fd, &st) < 0
/* No need to map the file if it is empty. */
|| st.st_size == 0)
{
@@ -699,7 +699,7 @@ load_aux_cache (const char *aux_cache_name)
}
struct stat64 st;
- if (fstat64 (fd, &st) < 0 || st.st_size < sizeof (struct aux_cache_file))
+ if (__fstat64 (fd, &st) < 0 || st.st_size < sizeof (struct aux_cache_file))
{
close (fd);
init_aux_cache ();
@@ -1914,7 +1914,7 @@ open_path (const char *name, size_t namelen, int mode,
buf[buflen - namelen - 1] = '\0';
- if (__xstat64 (_STAT_VER, buf, &st) != 0
+ if (__stat64 (buf, &st) != 0
|| ! S_ISDIR (st.st_mode))
/* The directory does not exist or it is no directory. */
this_dir->status[cnt] = nonexisting;
@@ -1934,7 +1934,7 @@ open_path (const char *name, size_t namelen, int mode,
directories and so exploit the bugs. */
struct stat64 st;
- if (__fxstat64 (_STAT_VER, fd, &st) != 0
+ if (__fstat64 (fd, &st) != 0
|| (st.st_mode & S_ISUID) == 0)
{
/* The shared object cannot be tested for being SUID
@@ -47,7 +47,7 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
int fd = __open64_nocancel (file, O_RDONLY | O_CLOEXEC);
if (fd >= 0)
{
- if (__fxstat64 (_STAT_VER, fd, &st) >= 0)
+ if (__fstat64 (fd, &st) >= 0)
{
*sizep = st.st_size;
@@ -342,7 +342,7 @@ _dl_start_profile (void)
return;
}
- if (__fxstat64 (_STAT_VER, fd, &st) < 0 || !S_ISREG (st.st_mode))
+ if (__fstat64 (fd, &st) < 0 || !S_ISREG (st.st_mode))
{
/* Not stat'able or not a regular file => don't use it. */
errstr = "%s: cannot stat file: %s\n";
@@ -64,7 +64,7 @@ __gconv_load_cache (void)
return -1;
/* Get information about the file. */
- if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0
+ if (__builtin_expect (__fstat64 (fd, &st), 0) < 0
/* We do not have to start looking at the file if it cannot contain
at least the cache header. */
|| (size_t) st.st_size < sizeof (struct gconvcache_header))
@@ -53,6 +53,7 @@ extern __typeof (__fxstatat64) __fxstatat64 attribute_hidden;
#define lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
#define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
#define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
+#define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
#define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
#define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
#define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
@@ -474,7 +474,7 @@ iruserfopen (const char *file, uid_t okuser)
/* If not a regular file, if owned by someone other than user or
root, if writeable by anyone but the owner, or if hardlinked
anywhere, quit. */
- if (__lxstat64 (_STAT_VER, file, &st))
+ if (__lstat64 (file, &st))
cp = _("lstat failed");
else if (!S_ISREG (st.st_mode))
cp = _("not regular file");
@@ -483,7 +483,7 @@ iruserfopen (const char *file, uid_t okuser)
res = fopen (file, "rce");
if (!res)
cp = _("cannot open");
- else if (__fxstat64 (_STAT_VER, fileno (res), &st) < 0)
+ else if (__fstat64 (fileno (res), &st) < 0)
cp = _("fstat failed");
else if (st.st_uid && st.st_uid != okuser)
cp = _("bad owner");
@@ -174,7 +174,7 @@ next:
break;
case PASSWD:
if (strcmp(*aname, "anonymous") &&
- fstat64(fileno(cfile), &stb) >= 0 &&
+ __fstat64(fileno(cfile), &stb) >= 0 &&
(stb.st_mode & 077) != 0) {
warnx(_("Error: .netrc file is readable by others."));
warnx(_("Remove 'password' line or make file unreadable by others."));
@@ -804,7 +804,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
/* We must know about the size of the file. */
if (
#ifdef _LIBC
- __builtin_expect (fstat64 (fd, &st) != 0, 0)
+ __builtin_expect (__fstat64 (fd, &st) != 0, 0)
#else
__builtin_expect (fstat (fd, &st) != 0, 0)
#endif
@@ -67,7 +67,7 @@ __file_change_detection_for_path (struct file_change_detection *file,
const char *path)
{
struct stat64 st;
- if (stat64 (path, &st) != 0)
+ if (__stat64 (path, &st) != 0)
switch (errno)
{
case EACCES:
@@ -105,7 +105,7 @@ __file_change_detection_for_fp (struct file_change_detection *file,
else
{
struct stat64 st;
- if (fstat64 (__fileno (fp), &st) != 0)
+ if (__fstat64 (__fileno (fp), &st) != 0)
/* If we already have a file descriptor, all errors are fatal. */
return false;
else
@@ -81,8 +81,9 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
# define FTSOBJ FTS
# define FTSENTRY FTSENT
# define INO_T ino_t
-# define STAT stat
-# define LSTAT lstat
+# define STRUCT_STAT stat
+# define STAT __stat
+# define LSTAT __lstat
#endif
static FTSENTRY *fts_alloc (FTSOBJ *, const char *, size_t);
@@ -872,7 +873,7 @@ fts_stat (FTSOBJ *sp, FTSENTRY *p, int follow)
FTSENTRY *t;
dev_t dev;
INO_T ino;
- struct STAT *sbp, sb;
+ struct STRUCT_STAT *sbp, sb;
int saved_errno;
/* If user needs stat info, stat buffer already allocated. */
@@ -906,7 +907,7 @@ fts_stat (FTSOBJ *sp, FTSENTRY *p, int follow)
}
} else if (LSTAT(p->fts_accpath, sbp)) {
p->fts_errno = errno;
-err: memset(sbp, 0, sizeof(struct STAT));
+err: memset(sbp, 0, sizeof(struct STRUCT_STAT));
return (FTS_NS);
}
@@ -996,7 +997,7 @@ fts_alloc (FTSOBJ *sp, const char *name, size_t namelen)
*/
len = sizeof(FTSENTRY) + namelen;
if (!ISSET(FTS_NOSTAT))
- len += sizeof(struct STAT) + ALIGNBYTES;
+ len += sizeof(struct STRUCT_STAT) + ALIGNBYTES;
if ((p = malloc(len)) == NULL)
return (NULL);
@@ -1005,7 +1006,7 @@ fts_alloc (FTSOBJ *sp, const char *name, size_t namelen)
p->fts_name[namelen] = '\0';
if (!ISSET(FTS_NOSTAT))
- p->fts_statp = (struct STAT *)ALIGN(p->fts_name + namelen + 2);
+ p->fts_statp = (struct STRUCT_STAT *)ALIGN(p->fts_name + namelen + 2);
p->fts_namelen = namelen;
p->fts_path = sp->fts_path;
p->fts_errno = 0;
@@ -1116,7 +1117,7 @@ fts_safe_changedir (FTSOBJ *sp, FTSENTRY *p, int fd, const char *path)
return (0);
if (fd < 0 && (newfd = __open(path, O_RDONLY, 0)) < 0)
return (-1);
- if (__fxstat64(_STAT_VER, newfd, &sb)) {
+ if (__fstat64(newfd, &sb)) {
ret = -1;
goto bail;
}
@@ -24,7 +24,8 @@
#define FTSOBJ FTS64
#define FTSENTRY FTSENT64
#define INO_T ino64_t
-#define STAT stat64
-#define LSTAT lstat64
+#define STRUCT_STAT stat64
+#define STAT __stat64
+#define LSTAT __lstat64
#include "fts.c"
@@ -135,15 +135,15 @@ int rpl_lstat (const char *, struct stat *);
# define NFTW_OLD_NAME __old_nftw
# define NFTW_NEW_NAME __new_nftw
# define INO_T ino_t
-# define STAT stat
+# define STRUCT_STAT stat
# ifdef _LIBC
-# define LXSTAT __lxstat
-# define XSTAT __xstat
-# define FXSTATAT __fxstatat
+# define LSTAT __lstat
+# define STAT __stat
+# define FSTATAT __fstatat
# else
-# define LXSTAT(V,f,sb) lstat (f,sb)
-# define XSTAT(V,f,sb) stat (f,sb)
-# define FXSTATAT(V,d,f,sb,m) fstatat (d, f, sb, m)
+# define LSTAT lstat
+# define XTAT stat
+# define FSTATAT fstatat
# endif
# define FTW_FUNC_T __ftw_func_t
# define NFTW_FUNC_T __nftw_func_t
@@ -219,7 +219,7 @@ static const int ftw_arr[] =
/* Forward declarations of local functions. */
-static int ftw_dir (struct ftw_data *data, struct STAT *st,
+static int ftw_dir (struct ftw_data *data, struct STRUCT_STAT *st,
struct dir_data *old_dir);
@@ -239,7 +239,7 @@ object_compare (const void *p1, const void *p2)
static int
-add_object (struct ftw_data *data, struct STAT *st)
+add_object (struct ftw_data *data, struct STRUCT_STAT *st)
{
struct known_object *newp = malloc (sizeof (struct known_object));
if (newp == NULL)
@@ -251,7 +251,7 @@ add_object (struct ftw_data *data, struct STAT *st)
static inline int
-find_object (struct ftw_data *data, struct STAT *st)
+find_object (struct ftw_data *data, struct STRUCT_STAT *st)
{
struct known_object obj;
obj.dev = st->st_dev;
@@ -378,7 +378,7 @@ static int
process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
size_t namlen, int d_type)
{
- struct STAT st;
+ struct STRUCT_STAT st;
int result = 0;
int flag = 0;
size_t new_buflen;
@@ -405,16 +405,16 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
int statres;
if (dir->streamfd != -1)
- statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st,
- (data->flags & FTW_PHYS) ? AT_SYMLINK_NOFOLLOW : 0);
+ statres = FSTATAT (dir->streamfd, name, &st,
+ (data->flags & FTW_PHYS) ? AT_SYMLINK_NOFOLLOW : 0);
else
{
if ((data->flags & FTW_CHDIR) == 0)
name = data->dirbuf;
statres = ((data->flags & FTW_PHYS)
- ? LXSTAT (_STAT_VER, name, &st)
- : XSTAT (_STAT_VER, name, &st));
+ ? LSTAT (name, &st)
+ : STAT (name, &st));
}
if (statres < 0)
@@ -430,10 +430,10 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
it should contain information about the link (ala lstat).
We do our best to fill in what data we can. */
if (dir->streamfd != -1)
- statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st,
- AT_SYMLINK_NOFOLLOW);
+ statres = FSTATAT (dir->streamfd, name, &st,
+ AT_SYMLINK_NOFOLLOW);
else
- statres = LXSTAT (_STAT_VER, name, &st);
+ statres = LSTAT (name, &st);
if (statres == 0 && S_ISLNK (st.st_mode))
flag = FTW_SLN;
else
@@ -476,7 +476,7 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
static int
__attribute ((noinline))
-ftw_dir (struct ftw_data *data, struct STAT *st, struct dir_data *old_dir)
+ftw_dir (struct ftw_data *data, struct STRUCT_STAT *st, struct dir_data *old_dir)
{
struct dir_data dir;
struct dirent64 *d;
@@ -630,7 +630,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
int flags)
{
struct ftw_data data;
- struct STAT st;
+ struct STRUCT_STAT st;
int result = 0;
int save_err;
int cwdfd = -1;
@@ -740,12 +740,12 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
name = data.dirbuf;
if (((flags & FTW_PHYS)
- ? LXSTAT (_STAT_VER, name, &st)
- : XSTAT (_STAT_VER, name, &st)) < 0)
+ ? LSTAT (name, &st)
+ : STAT (name, &st)) < 0)
{
if (!(flags & FTW_PHYS)
&& errno == ENOENT
- && LXSTAT (_STAT_VER, name, &st) == 0
+ && LSTAT (name, &st) == 0
&& S_ISLNK (st.st_mode))
result = (*data.func) (data.dirbuf, &st, data.cvt_arr[FTW_SLN],
&data.ftw);
@@ -22,10 +22,10 @@
#define NFTW_OLD_NAME __old_nftw64
#define NFTW_NEW_NAME __new_nftw64
#define INO_T ino64_t
-#define STAT stat64
-#define LXSTAT __lxstat64
-#define XSTAT __xstat64
-#define FXSTATAT __fxstatat64
+#define STRUCT_STAT stat64
+#define LSTAT __lstat64
+#define STAT __stat64
+#define FSTATAT __fstatat64
#define FTW_FUNC_T __ftw64_func_t
#define NFTW_FUNC_T __nftw64_func_t
@@ -32,8 +32,8 @@ get_current_dir_name (void)
pwd = getenv ("PWD");
if (pwd != NULL
- && stat64 (".", &dotstat) == 0
- && stat64 (pwd, &pwdstat) == 0
+ && __stat64 (".", &dotstat) == 0
+ && __stat64 (pwd, &pwdstat) == 0
&& pwdstat.st_dev == dotstat.st_dev
&& pwdstat.st_ino == dotstat.st_ino)
/* The PWD value is correct. Use it. */
@@ -36,7 +36,7 @@ mkdirat (int fd, const char *path, mode_t mode)
{
/* Check FD is associated with a directory. */
struct stat64 st;
- if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+ if (__fstat64 (fd, &st) != 0)
return -1;
if (!S_ISDIR (st.st_mode))
@@ -37,7 +37,7 @@ mkfifoat (int fd, const char *path, mode_t mode)
{
/* Check FD is associated with a directory. */
struct stat64 st;
- if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+ if (__fstat64 (fd, &st) != 0)
return -1;
if (!S_ISDIR (st.st_mode))
@@ -47,7 +47,7 @@ __openat (int fd, const char *file, int oflag, ...)
{
/* Check FD is associated with a directory. */
struct stat64 st;
- if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+ if (__fstat64 (fd, &st) != 0)
return -1;
if (!S_ISDIR (st.st_mode))
@@ -40,7 +40,7 @@ __openat64 (int fd, const char *file, int oflag, ...)
{
/* Check FD is associated with a directory. */
struct stat64 st;
- if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+ if (__fstat64 (fd, &st) != 0)
return -1;
if (!S_ISDIR (st.st_mode))
@@ -44,7 +44,7 @@ __xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
{
/* Check FD is associated with a directory. */
struct stat64 st;
- if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+ if (__fstat64 (fd, &st) != 0)
return -1;
if (!S_ISDIR (st.st_mode))
@@ -1145,7 +1145,7 @@ libc_hidden_def (_IO_file_seek)
int
_IO_file_stat (FILE *fp, void *st)
{
- return __fxstat64 (_STAT_VER, fp->_fileno, (struct stat64 *) st);
+ return __fstat64 (fp->_fileno, (struct stat64 *) st);
}
libc_hidden_def (_IO_file_stat)
@@ -207,7 +207,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
/* Cannot open the archive, for whatever reason. */
return NULL;
- if (__fxstat64 (_STAT_VER, fd, &archive_stat) == -1)
+ if (__fstat64 (fd, &archive_stat) == -1)
{
/* stat failed, very strange. */
close_and_out:
@@ -405,7 +405,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
/* Now verify we think this is really the same archive file
we opened before. If it has been changed we cannot trust
the header we read previously. */
- if (__fxstat64 (_STAT_VER, fd, &st) < 0
+ if (__fstat64 (fd, &st) < 0
|| st.st_size != archive_stat.st_size
|| st.st_mtime != archive_stat.st_mtime
|| st.st_dev != archive_stat.st_dev
@@ -180,7 +180,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
/* Cannot open the file. */
return;
- if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0)
+ if (__builtin_expect (__fstat64 (fd, &st), 0) < 0)
{
puntfd:
__close_nocancel_nostatus (fd);
@@ -206,7 +206,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
if (__builtin_expect (fd, 0) < 0)
return;
- if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0)
+ if (__builtin_expect (__fstat64 (fd, &st), 0) < 0)
goto puntfd;
}
@@ -64,7 +64,7 @@ daemon (int nochdir, int noclose)
struct stat64 st;
if ((fd = __open_nocancel(_PATH_DEVNULL, O_RDWR, 0)) != -1
- && (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0)
+ && (__builtin_expect (__fstat64 (fd, &st), 0)
== 0)) {
if (__builtin_expect (S_ISCHR (st.st_mode), 1) != 0
#if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR
@@ -106,7 +106,7 @@ initshells (void)
strings = NULL;
if ((fp = fopen(_PATH_SHELLS, "rce")) == NULL)
goto init_okshells_noclose;
- if (fstat64(fileno(fp), &statb) == -1) {
+ if (__fstat64(fileno(fp), &statb) == -1) {
init_okshells:
(void)fclose(fp);
init_okshells_noclose:
@@ -68,7 +68,7 @@ check_add_mapping (const char *name, size_t namelen, int fd, sem_t *existing)
/* Get the information about the file. */
struct stat64 st;
- if (__fxstat64 (_STAT_VER, fd, &st) == 0)
+ if (__fstat64 (fd, &st) == 0)
{
/* Get the lock. */
lll_lock (__sem_mappings_lock, LLL_PRIVATE);
@@ -325,7 +325,7 @@ __nscd_get_mapping (request_type type, const char *key,
if (__glibc_unlikely (n == keylen))
{
struct stat64 st;
- if (__builtin_expect (fstat64 (mapfd, &st) != 0, 0)
+ if (__builtin_expect (__fstat64 (mapfd, &st) != 0, 0)
|| __builtin_expect (st.st_size < sizeof (struct database_pers_head),
0))
goto out_close;
@@ -49,12 +49,6 @@
# define readdir(str) __readdir64 (str)
# define getpwnam_r(name, bufp, buf, len, res) \
__getpwnam_r (name, bufp, buf, len, res)
-# ifndef __lstat64
-# define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
-# endif
-# ifndef __stat64
-# define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
-# endif
# define struct_stat64 struct stat64
# define FLEXIBLE_ARRAY_MEMBER
# include <shlib-compat.h>
@@ -63,7 +57,6 @@
# define __getlogin_r(buf, len) getlogin_r (buf, len)
# define __lstat64(fname, buf) lstat (fname, buf)
# define __stat64(fname, buf) stat (fname, buf)
-# define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag)
# define struct_stat64 struct stat
# ifndef __MVS__
# define __alloca alloca
@@ -158,7 +158,7 @@ __realpath (const char *name, char *resolved)
dest = __mempcpy (dest, start, end - start);
*dest = '\0';
- if (__lxstat64 (_STAT_VER, rpath, &st) < 0)
+ if (__lstat64 (rpath, &st) < 0)
goto error;
if (S_ISLNK (st.st_mode))
@@ -32,7 +32,7 @@
#undef stat
#define stat stat64
#undef __stat
-#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
+#define __stat(file, buf) __stat64 (file, buf)
#define COMPILE_GLOB64 1
@@ -12,7 +12,7 @@
#undef stat
#define stat stat64
#undef __stat
-#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
+#define __stat(file, buf) __stat64 (file, buf)
#define COMPILE_GLOB64 1
@@ -63,7 +63,7 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
if (stp)
{
- if (__xstat64 (_STAT_VER, peername, stp) < 0)
+ if (__stat64 (peername, stp) < 0)
return errno;
}
@@ -34,7 +34,7 @@ _dl_get_file_id (int fd, struct r_file_id *id)
{
struct stat64 st;
- if (__glibc_unlikely (__fxstat64 (_STAT_VER, fd, &st) < 0))
+ if (__glibc_unlikely (__fstat64 (fd, &st) < 0))
return false;
id->dev = st.st_dev;
@@ -140,7 +140,7 @@ euidaccess (const char *path, int mode)
return access (path, mode);
#endif
- if (stat64 (path, &stats))
+ if (__stat64 (path, &stats))
return -1;
mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */
@@ -29,7 +29,7 @@ __fdopendir (int fd)
{
struct stat64 statbuf;
- if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
+ if (__builtin_expect (__fstat64 (fd, &statbuf), 0) < 0)
return NULL;
if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
{
@@ -133,7 +133,7 @@ __fpathconf (int fd, int name)
/* AIO is only allowed on regular files and block devices. */
struct stat64 st;
- if (__fxstat64 (_STAT_VER, fd, &st) < 0
+ if (__fstat64 (fd, &st) < 0
|| (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode)))
return -1;
else
@@ -1785,7 +1785,7 @@ gaiconf_init (void)
if (fp != NULL)
{
struct stat64 st;
- if (__fxstat64 (_STAT_VER, fileno (fp), &st) != 0)
+ if (__fstat64 (fileno (fp), &st) != 0)
{
fclose (fp);
goto no_file;
@@ -2138,7 +2138,7 @@ static void
gaiconf_reload (void)
{
struct stat64 st;
- if (__xstat64 (_STAT_VER, GAICONF_FNAME, &st) != 0
+ if (stat64 (GAICONF_FNAME, &st) != 0
|| !check_gaiconf_mtime (&st))
gaiconf_init ();
}
@@ -29,7 +29,7 @@ isfdtype (int fildes, int fdtype)
{
int save_error = errno;
- result = fstat64 (fildes, &st);
+ result = __fstat64 (fildes, &st);
__set_errno (save_error);
}
@@ -56,7 +56,7 @@ opendir_tail (int fd)
`stat' call. The S_ISDIR check is superfluous if O_DIRECTORY works,
but it's cheap and we need the stat call for st_blksize anyway. */
struct stat64 statbuf;
- if (__glibc_unlikely (__fxstat64 (_STAT_VER, fd, &statbuf) < 0))
+ if (__glibc_unlikely (__fstat64 (fd, &statbuf) < 0))
goto lose;
if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
{
@@ -131,7 +131,7 @@ __pathconf (const char *path, int name)
/* AIO is only allowed on regular files and block devices. */
struct stat64 st;
- if (__xstat64 (_STAT_VER, path, &st) < 0
+ if (__stat64 (path, &st) < 0
|| (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode)))
return -1;
else
@@ -48,7 +48,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
}
/* We have to make sure that this is really a regular file. */
- if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+ if (__fstat64 (fd, &st) != 0)
return EBADF;
if (S_ISFIFO (st.st_mode))
return ESPIPE;
@@ -48,7 +48,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
}
/* We have to make sure that this is really a regular file. */
- if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+ if (__fstat64 (fd, &st) != 0)
return EBADF;
if (S_ISFIFO (st.st_mode))
return ESPIPE;
@@ -1216,7 +1216,7 @@ __sysconf_check_spec (const char *spec)
spec, speclen + 1);
struct stat64 st;
- long int ret = __xstat64 (_STAT_VER, name, &st) >= 0 ? 1 : -1;
+ long int ret = __stat64 (name, &st) >= 0 ? 1 : -1;
__set_errno (save_errno);
return ret;
@@ -65,7 +65,6 @@
# define __getpid getpid
# define __mkdir mkdir
# define __open open
-# define __lxstat64(version, file, buf) lstat (file, buf)
# define __secure_getenv secure_getenv
#endif
@@ -96,7 +95,7 @@ static int
direxists (const char *dir)
{
struct_stat64 buf;
- return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
+ return __stat64 (dir, &buf) == 0 && S_ISDIR (buf.st_mode);
}
/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
@@ -254,7 +253,7 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
succeeds if __xstat fails because the name does not exist.
Note the continue to bypass the common logic at the bottom
of the loop. */
- if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
+ if (__lstat64 (tmpl, &st) < 0)
{
if (errno == ENOENT)
{
@@ -37,7 +37,7 @@ faccessat (int fd, const char *file, int mode, int flag)
return INLINE_SYSCALL (faccessat, 3, fd, file, mode);
struct stat64 stats;
- if (__fxstatat64 (_STAT_VER, fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW))
+ if (__fstatat64 (fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW))
return -1;
mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */
@@ -60,8 +60,8 @@ fexecve (int fd, char *const argv[], char *const envp[])
/* We come here only if the 'execve' call fails. Determine whether
/proc is mounted. If not we return ENOSYS. */
- struct stat st;
- if (stat ("/proc/self/fd", &st) != 0 && errno == ENOENT)
+ struct stat64 st;
+ if (__stat64 ("/proc/self/fd", &st) != 0 && errno == ENOENT)
save = ENOSYS;
__set_errno (save);
@@ -31,7 +31,7 @@ libc_hidden_proto (__old_glob64);
#undef stat
#define stat stat64
#undef __stat
-#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
+#define __stat(file, buf) __stat64 (file, buf)
/* Avoid calling gl_lstat with GLOB_ALTDIRFUNC. */
#define GLOB_NO_LSTAT
@@ -67,7 +67,7 @@ distinguish_extX (const struct statfs *fsbuf, const char *file, int fd)
char path[PATH_MAX];
struct stat64 st;
- if ((file == NULL ? fstat64 (fd, &st) : stat64 (file, &st)) != 0)
+ if ((file == NULL ? __fstat64 (fd, &st) : __stat64 (file, &st)) != 0)
/* Strange. The statfd call worked, but stat fails. Default to
the more pessimistic value. */
return EXT2_LINK_MAX;
@@ -110,7 +110,7 @@ distinguish_extX (const struct statfs *fsbuf, const char *file, int fd)
continue;
struct stat64 fsst;
- if (stat64 (mntbuf.mnt_dir, &fsst) >= 0
+ if (__stat64 (mntbuf.mnt_dir, &fsst) >= 0
&& st.st_dev == fsst.st_dev)
{
if (strcmp (mntbuf.mnt_type, "ext4") == 0)
@@ -114,7 +114,7 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
return ERANGE;
}
- if (__fxstat64 (_STAT_VER, fd, stp) < 0)
+ if (__fstat64 (fd, stp) < 0)
return errno;
/* Check if FD really is a master pseudo terminal. */
@@ -138,7 +138,7 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
p[2] = '\0';
}
- if (__xstat64 (_STAT_VER, buf, stp) < 0)
+ if (__stat64 (buf, stp) < 0)
return errno;
/* Check if the name we're about to return really corresponds to a
@@ -84,7 +84,7 @@ getttyname (const char *dev, const struct stat64 *mytty, int save, int *dostat)
*((char *) __mempcpy (getttyname_name, dev, devlen - 1)) = '/';
}
memcpy (&getttyname_name[devlen], d->d_name, dlen);
- if (__xstat64 (_STAT_VER, getttyname_name, &st) == 0
+ if (__stat64 (getttyname_name, &st) == 0
&& is_mytty (mytty, &st))
{
(void) __closedir (dirstream);
@@ -125,7 +125,7 @@ ttyname (int fd)
if (__glibc_unlikely (__tcgetattr (fd, &term) < 0))
return NULL;
- if (__fxstat64 (_STAT_VER, fd, &st) < 0)
+ if (__fstat64 (fd, &st) < 0)
return NULL;
/* We try using the /proc filesystem. */
@@ -162,14 +162,14 @@ ttyname (int fd)
/* Verify readlink result, fall back on iterating through devices. */
if (ttyname_buf[0] == '/'
- && __xstat64 (_STAT_VER, ttyname_buf, &st1) == 0
+ && __stat64 (ttyname_buf, &st1) == 0
&& is_mytty (&st, &st1))
return ttyname_buf;
doispty = 1;
}
- if (__xstat64 (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
+ if (__stat64 ("/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
{
name = getttyname ("/dev/pts", &st, save, &dostat);
}
@@ -71,7 +71,7 @@ getttyname_r (char *buf, size_t buflen, const struct stat64 *mytty,
cp = __stpncpy (buf + devlen, d->d_name, needed);
cp[0] = '\0';
- if (__xstat64 (_STAT_VER, buf, &st) == 0
+ if (__stat64 (buf, &st) == 0
&& is_mytty (mytty, &st))
{
(void) __closedir (dirstream);
@@ -118,7 +118,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
if (__glibc_unlikely (__tcgetattr (fd, &term) < 0))
return errno;
- if (__fxstat64 (_STAT_VER, fd, &st) < 0)
+ if (__fstat64 (fd, &st) < 0)
return errno;
/* We try using the /proc filesystem. */
@@ -146,7 +146,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
/* Verify readlink result, fall back on iterating through devices. */
if (buf[0] == '/'
- && __xstat64 (_STAT_VER, buf, &st1) == 0
+ && __stat64 (buf, &st1) == 0
&& is_mytty (&st, &st1))
return 0;
@@ -157,7 +157,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
memcpy (buf, "/dev/pts/", sizeof ("/dev/pts/"));
buflen -= sizeof ("/dev/pts/") - 1;
- if (__xstat64 (_STAT_VER, buf, &st1) == 0 && S_ISDIR (st1.st_mode))
+ if (__stat64 (buf, &st1) == 0 && S_ISDIR (st1.st_mode))
{
ret = getttyname_r (buf, buflen, &st, save,
&dostat);
@@ -25,7 +25,7 @@ ftok (const char *pathname, int proj_id)
struct stat64 st;
key_t key;
- if (__xstat64 (_STAT_VER, pathname, &st) < 0)
+ if (__stat64 (pathname, &st) < 0)
return (key_t) -1;
key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16)
@@ -121,7 +121,7 @@ __getdate_r (const char *string, struct tm *tp)
if (datemsk == NULL || *datemsk == '\0')
return 1;
- if (stat64 (datemsk, &st) < 0)
+ if (__stat64 (datemsk, &st) < 0)
return 3;
if (!S_ISREG (st.st_mode))
@@ -152,7 +152,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
/* If we were already using tzfile, check whether the file changed. */
struct stat64 st;
if (was_using_tzfile
- && stat64 (file, &st) == 0
+ && __stat64 (file, &st) == 0
&& tzfile_ino == st.st_ino && tzfile_dev == st.st_dev
&& tzfile_mtime == st.st_mtime)
goto done; /* Nothing to do. */
@@ -164,7 +164,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
goto ret_free_transitions;
/* Get information about the file we are actually using. */
- if (fstat64 (__fileno (f), &st) != 0)
+ if (__fstat64 (__fileno (f), &st) != 0)
goto lose;
free ((void *) transitions);