[PATCH v2 2/2] MIPS: N64, make xstat as wrapper of generic fstatat
YunQiang Su
yunqiang.su@cipunited.com
Fri Mar 19 01:18:37 GMT 2021
fxstatat as wrapper of fstatat
fxstatat64 as wrapper of fstatat64
fxstat, lxstat, xstat as wrapper of fxstatat
fxstat64, lxstat64, xstat64 as wrapper of fxstatat64
---
.../unix/sysv/linux/mips/mips64/n64/fxstat.c | 27 +++++++++++++
.../sysv/linux/mips/mips64/n64/fxstat64.c | 28 ++++++++++++++
.../sysv/linux/mips/mips64/n64/fxstatat.c | 38 +++++++++++++++++++
.../sysv/linux/mips/mips64/n64/fxstatat64.c | 34 +++++++++++++++++
.../unix/sysv/linux/mips/mips64/n64/lxstat.c | 27 +++++++++++++
.../sysv/linux/mips/mips64/n64/lxstat64.c | 27 +++++++++++++
.../unix/sysv/linux/mips/mips64/n64/xstat.c | 27 +++++++++++++
.../unix/sysv/linux/mips/mips64/n64/xstat64.c | 28 ++++++++++++++
8 files changed, 236 insertions(+)
create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/fxstat.c
create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/fxstat64.c
create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/fxstatat.c
create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/fxstatat64.c
create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/lxstat.c
create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/lxstat64.c
create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/xstat.c
create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/xstat64.c
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/fxstat.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/fxstat.c
new file mode 100644
index 0000000000..037b2bb080
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/fxstat.c
@@ -0,0 +1,27 @@
+/* fxstat using old-style Unix stat system call.
+ Copyright (C) 1991-2021 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>
+
+/* Get information about the file NAME in BUF. */
+int
+__fxstat (int vers, int fd, struct stat *buf)
+{
+ return __fxstatat(vers, fd, "", buf, AT_EMPTY_PATH);
+}
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/fxstat64.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/fxstat64.c
new file mode 100644
index 0000000000..4c2d461667
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/fxstat64.c
@@ -0,0 +1,28 @@
+/* fxstat64 using 64-bit MIPS fstat system call.
+ Copyright (C) 1997-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>
+
+/* Get information about the file FD in BUF. */
+
+int
+__fxstat64 (int vers, int fd, struct stat64 *buf)
+{
+ return __fxstatat64(vers, fd, "", buf, AT_EMPTY_PATH);
+}
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/fxstatat.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/fxstatat.c
new file mode 100644
index 0000000000..6d94f12bce
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/fxstatat.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2005-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/>. */
+
+/* Ho hum, since fxstatat == fxstatat64 we must get rid of the
+ prototype or gcc will complain since they don't strictly match. */
+
+#include <sys/syscall.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* Get information about the file NAME relative to FD in ST. */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+ if (__builtin_expect (vers != _STAT_VER_LINUX, 0))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __fstatat(fd, file, st, flag);
+
+}
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/fxstatat64.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/fxstatat64.c
new file mode 100644
index 0000000000..b5b0eac92f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/fxstatat64.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2005-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 <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* Get information about the file NAME in BUF. */
+
+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;
+ }
+
+ return __fstatat64_time64(fd, file, st, flag);
+}
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/lxstat.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/lxstat.c
new file mode 100644
index 0000000000..43dd4e76b7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/lxstat.c
@@ -0,0 +1,27 @@
+/* lxstat using old-style Unix stat system call.
+ Copyright (C) 1991-2021 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>
+
+/* Get information about the file NAME in BUF. */
+int
+__lxstat (int vers, const char *name, struct stat *buf)
+{
+ return __fxstatat(vers, AT_FDCWD, name, buf, AT_SYMLINK_NOFOLLOW);
+}
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/lxstat64.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/lxstat64.c
new file mode 100644
index 0000000000..232878a74a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/lxstat64.c
@@ -0,0 +1,27 @@
+/* lxstat64 using 64-bit MIPS lstat system call.
+ Copyright (C) 1997-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>
+
+/* Get information about the file NAME in BUF. */
+int
+__lxstat64 (int vers, const char *name, struct stat64 *buf)
+{
+ return __fxstatat64(vers, AT_FDCWD, name, buf, AT_SYMLINK_NOFOLLOW);
+}
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/xstat.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/xstat.c
new file mode 100644
index 0000000000..68e62fc3b3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/xstat.c
@@ -0,0 +1,27 @@
+/* xstat using old-style Unix stat system call.
+ Copyright (C) 1991-2021 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>
+
+/* Get information about the file NAME in BUF. */
+int
+__xstat (int vers, const char *name, struct stat *buf)
+{
+ return __fxstatat(vers, AT_FDCWD, name, buf, 0);
+}
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/xstat64.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/xstat64.c
new file mode 100644
index 0000000000..06f9738a65
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/xstat64.c
@@ -0,0 +1,28 @@
+/* xstat64 using 64-bit MIPS stat 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>
+
+/* Get information about the file NAME in BUF. */
+
+int
+__xstat64 (int vers, const char *name, struct stat64 *buf)
+{
+ return __fxstatat64(vers, AT_FDCWD, name, buf, 0);
+}
--
2.31.0
More information about the Libc-alpha
mailing list