about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/mips
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/mips')
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/fxstatat.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c33
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c28
3 files changed, 38 insertions, 24 deletions
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fxstatat.c b/sysdeps/unix/sysv/linux/mips/mips32/fxstatat.c
deleted file mode 100644
index 0f8b3135d8..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips32/fxstatat.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c
new file mode 100644
index 0000000000..58410a1441
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c
@@ -0,0 +1,33 @@
+/* fxstat using old-style Unix fstat system call.
+   Copyright (C) 1991-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>
+#include <sysdep.h>
+#include <xstatconv.h>
+
+/* Get information about the file FD in BUF.  */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+  struct kernel_stat kst;
+  int r = INLINE_SYSCALL_CALL (newfstatat, fd, file, &kst, flag);
+  return r ?: __xstat_conv (vers, &kst, st);
+}
+libc_hidden_def (__fxstatat)
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c
index 62df5fb26c..e5416d8971 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c
@@ -15,17 +15,9 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <fcntl.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
 #include <sys/stat.h>
 #include <kernel_stat.h>
-
 #include <sysdep.h>
-#include <sys/syscall.h>
-
 #include <xstatconv.h>
 
 /* Get information about the file NAME in BUF.  */
@@ -33,22 +25,12 @@
 int
 __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
 {
-  if (__builtin_expect (vers != _STAT_VER_LINUX, 0))
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  int result;
-  struct kernel_stat kst;
-
-  result = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag);
-  if (!__glibc_likely (INTERNAL_SYSCALL_ERROR_P (result)))
-    return __xstat64_conv (vers, &kst, st);
-  else
+  if (vers == _STAT_VER_LINUX)
     {
-      __set_errno (INTERNAL_SYSCALL_ERRNO (result));
-      return -1;
+      struct kernel_stat kst;
+      int r = INLINE_SYSCALL_CALL (newfstatat, fd, file, &kst, flag);;
+      return r ?: __xstat64_conv (vers, &kst, st);
     }
+  return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
 }
 libc_hidden_def (__fxstatat64)