about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-07-15 19:35:58 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-09-11 14:35:32 -0300
commit04986243d1af37ac0177ed2f9db0a066ebd2b212 (patch)
tree87b9cebcc14f51dd0cf4103be16fc26542b65c69 /sysdeps
parent23159962159038891d3211c5632c3900d465f0c7 (diff)
downloadglibc-04986243d1af37ac0177ed2f9db0a066ebd2b212.tar.gz
glibc-04986243d1af37ac0177ed2f9db0a066ebd2b212.tar.xz
glibc-04986243d1af37ac0177ed2f9db0a066ebd2b212.zip
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 <lukma@denx.de>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/gnu/glob64-lstat-compat.c2
-rw-r--r--sysdeps/gnu/glob64.c2
-rw-r--r--sysdeps/mach/hurd/ptsname.c2
-rw-r--r--sysdeps/posix/dl-fileid.h2
-rw-r--r--sysdeps/posix/euidaccess.c2
-rw-r--r--sysdeps/posix/fdopendir.c2
-rw-r--r--sysdeps/posix/fpathconf.c2
-rw-r--r--sysdeps/posix/getaddrinfo.c4
-rw-r--r--sysdeps/posix/isfdtype.c2
-rw-r--r--sysdeps/posix/opendir.c2
-rw-r--r--sysdeps/posix/pathconf.c2
-rw-r--r--sysdeps/posix/posix_fallocate.c2
-rw-r--r--sysdeps/posix/posix_fallocate64.c2
-rw-r--r--sysdeps/posix/sysconf.c2
-rw-r--r--sysdeps/posix/tempname.c7
-rw-r--r--sysdeps/unix/sysv/linux/faccessat.c2
-rw-r--r--sysdeps/unix/sysv/linux/fexecve.c4
-rw-r--r--sysdeps/unix/sysv/linux/oldglob.c2
-rw-r--r--sysdeps/unix/sysv/linux/pathconf.c4
-rw-r--r--sysdeps/unix/sysv/linux/ptsname.c4
-rw-r--r--sysdeps/unix/sysv/linux/ttyname.c8
-rw-r--r--sysdeps/unix/sysv/linux/ttyname_r.c8
22 files changed, 34 insertions, 35 deletions
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..1864c860ad 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
@@ -251,10 +250,10 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
 
 	case __GT_NOCREATE:
 	  /* This case is backward from the other three.  __gen_tempname
-	     succeeds if __xstat fails because the name does not exist.
+	     succeeds if lstat 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 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);