From 04986243d1af37ac0177ed2f9db0a066ebd2b212 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Wed, 15 Jul 2020 19:35:58 +0000 Subject: Remove internal usage of extensible stat functions 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 --- 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 ++++---- 7 files changed, 16 insertions(+), 16 deletions(-) (limited to 'sysdeps/unix/sysv/linux') diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c index 56cb6dcc8b..b697053da1 100644 --- a/sysdeps/unix/sysv/linux/faccessat.c +++ b/sysdeps/unix/sysv/linux/faccessat.c @@ -44,7 +44,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); -- cgit 1.4.1