new file mode 100644
@@ -0,0 +1,54 @@
+/* fxstat implemented with statx system call. C-SKY version.
+ Copyright (C) 2018 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+#if !XSTAT_IS_XSTAT64
+#include "overflow.h"
+
+
+extern void __cp_stat_statx (struct stat *to, struct statx *from);
+
+/* Get information about the file FD in BUF. */
+int
+__fxstat (int vers, int fd, struct stat *buf)
+{
+ if (vers == _STAT_VER_KERNEL)
+ {
+ struct statx tmp;
+ int rc = INLINE_SYSCALL (statx, 5, fd, "", AT_EMPTY_PATH,
+ STATX_BASIC_STATS, &tmp);
+ __cp_stat_statx (buf, &tmp);
+ return rc ?: stat_overflow (buf);
+ }
+
+ errno = EINVAL;
+ return -1;
+}
+
+hidden_def (__fxstat)
+weak_alias (__fxstat, _fxstat);
+#endif
new file mode 100644
@@ -0,0 +1,68 @@
+/* fxstat64 implemented with statx system call. C-SKY version.
+ Copyright (C) 2018 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+#include <kernel-features.h>
+
+/* Get information about the file FD in BUF. */
+
+extern void __cp_stat64_statx (struct stat64 *to, struct statx *from);
+
+int
+___fxstat64 (int vers, int fd, struct stat64 *buf)
+{
+ int result;
+ struct statx tmp;
+ result = INLINE_SYSCALL (statx, 5, fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS,
+ &tmp);
+ __cp_stat64_statx (buf, &tmp);
+#if defined _HAVE_STAT64___ST_INO && !__ASSUME_ST_INO_64_BIT
+ if (__builtin_expect (!result, 1) && buf->__st_ino != (__ino_t) buf->st_ino)
+ buf->st_ino = buf->__st_ino;
+#endif
+ return result;
+}
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+versioned_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2);
+strong_alias (___fxstat64, __old__fxstat64)
+compat_symbol (libc, __old__fxstat64, __fxstat64, GLIBC_2_1);
+hidden_ver (___fxstat64, __fxstat64)
+#else
+strong_alias (___fxstat64, __fxstat64)
+hidden_def (__fxstat64)
+#endif
+
+#undef __fxstat
+#undef _fxstat
+#if XSTAT_IS_XSTAT64
+weak_alias (__fxstat64, __fxstat)
+weak_alias (__fxstat64, _fxstat)
+hidden_ver (__fxstat64, __fxstat)
+#endif
new file mode 100644
@@ -0,0 +1,52 @@
+/* fxstatat implemented with statx system call. C-SKY version.
+ Copyright (C) 2018 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+#if !XSTAT_IS_XSTAT64
+#include "overflow.h"
+
+extern void __cp_stat_statx (struct stat *to, struct statx *from);
+
+/* Get information about the file NAME in BUF. */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *buf, int flag)
+{
+ if (vers == _STAT_VER_KERNEL)
+ {
+ struct statx tmp;
+ int rc = INLINE_SYSCALL (statx, 5, fd, file,
+ AT_NO_AUTOMOUNT | flag,
+ STATX_BASIC_STATS, &tmp);
+ __cp_stat_statx (buf, &tmp);
+ return rc ?: stat_overflow (buf);
+ }
+
+ errno = EINVAL;
+ return -1;
+}
+libc_hidden_def (__fxstatat)
+#endif
new file mode 100644
@@ -0,0 +1,54 @@
+/* fxstatat64 implemented with statx system call. C-SKY version.
+ Copyright (C) 2018 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
+ <http://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>
+
+extern void __cp_stat64_statx (struct stat64 *to, struct statx *from);
+
+/* Get information about the file NAME in BUF. */
+
+int
+__fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
+{
+ if (__glibc_unlikely (vers != _STAT_VER_LINUX))
+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
+
+ int result;
+ struct statx tmp;
+ INTERNAL_SYSCALL_DECL (err);
+
+ result = INTERNAL_SYSCALL (statx, err, 5, fd, file,
+ AT_NO_AUTOMOUNT | flag,
+ STATX_BASIC_STATS, &tmp);
+ __cp_stat64_statx (st, &tmp);
+ if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return 0;
+ else
+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result,
+ err));
+}
+libc_hidden_def (__fxstatat64)
new file mode 100644
@@ -0,0 +1,50 @@
+/* lxstat implemented with statx system call. C-SKY version.
+ Copyright (C) 2018 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+#if !XSTAT_IS_XSTAT64
+#include "overflow.h"
+
+extern void __cp_stat_statx (struct stat *to, struct statx *from);
+
+/* Get information about the file NAME in BUF. */
+int
+__lxstat (int vers, const char *name, struct stat *buf)
+{
+ if (vers == _STAT_VER_KERNEL)
+ {
+ struct statx tmp;
+ int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, name,
+ AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW,
+ STATX_BASIC_STATS, &tmp);
+ __cp_stat_statx (buf, &tmp);
+ return rc ?: stat_overflow (buf);
+ }
+ errno = EINVAL;
+ return -1;
+}
+hidden_def (__lxstat)
+#endif
new file mode 100644
@@ -0,0 +1,60 @@
+/* lxstat64 implemented with statx system call. C-SKY version.
+ Copyright (C) 2018 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
+ <http://www.gnu.org/licenses/>. */
+
+/* Hide the prototype for __lxstat so that GCC will not complain about
+ the different function signature if it is aliased to __lxstat64.
+ If XSTAT_IS_XSTAT64 is set to non-zero then the stat and stat64
+ structures have an identical layout but different type names. */
+
+#define __lxstat __lxstat_disable
+
+#include <errno.h>
+#include <stddef.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+extern void __cp_stat64_statx (struct stat64 *to, struct statx *from);
+
+/* Get information about the file NAME in BUF. */
+int
+__lxstat64 (int vers, const char *name, struct stat64 *buf)
+{
+ int ret;
+ struct statx tmp;
+ if (vers == _STAT_VER_KERNEL)
+ {
+ ret = INLINE_SYSCALL (statx, 5, AT_FDCWD, name,
+ AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW,
+ STATX_BASIC_STATS, &tmp);
+ __cp_stat64_statx (buf, &tmp);
+ return ret;
+ }
+ errno = EINVAL;
+ return -1;
+}
+hidden_def (__lxstat64)
+
+#undef __lxstat
+#if XSTAT_IS_XSTAT64
+strong_alias (__lxstat64, __lxstat)
+hidden_ver (__lxstat64, __lxstat)
+#endif
new file mode 100644
@@ -0,0 +1,75 @@
+/* Struct statx to stat/stat64 conversion for Linux. C-SKY version.
+ Copyright (C) 2018 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+void
+__cp_stat_statx (struct stat *to, struct statx *from)
+{
+ memset(to, 0, sizeof(struct stat));
+ to->st_dev = (from->stx_dev_minor & 0xff) | (from->stx_dev_major << 8) |
+ ((from->stx_dev_minor & ~0xff) << 12);
+ to->st_rdev = (from->stx_rdev_minor & 0xff) | (from->stx_rdev_major << 8) |
+ ((from->stx_rdev_minor & ~0xff) << 12);
+ to->st_ino = from->stx_ino;
+ to->st_mode = from->stx_mode;
+ to->st_nlink = from->stx_nlink;
+ to->st_uid = from->stx_uid;
+ to->st_gid = from->stx_gid;
+ to->st_atime = from->stx_atime.tv_sec;
+ to->st_atim.tv_nsec = from->stx_atime.tv_nsec;
+ to->st_mtime = from->stx_mtime.tv_sec;
+ to->st_mtim.tv_nsec = from->stx_mtime.tv_nsec;
+ to->st_ctime = from->stx_ctime.tv_sec;
+ to->st_ctim.tv_nsec = from->stx_ctime.tv_nsec;
+ to->st_size = from->stx_size;
+ to->st_blocks = from->stx_blocks;
+ to->st_blksize = from->stx_blksize;
+}
+
+void
+__cp_stat64_statx (struct stat64 *to, struct statx *from)
+{
+ memset(to, 0, sizeof(struct stat64));
+ to->st_dev = (from->stx_dev_minor & 0xff) | (from->stx_dev_major << 8) |
+ ((from->stx_dev_minor & ~0xff) << 12);
+ to->st_rdev = (from->stx_rdev_minor & 0xff) | (from->stx_rdev_major << 8) |
+ ((from->stx_rdev_minor & ~0xff) << 12);
+ to->st_ino = from->stx_ino;
+ to->st_mode = from->stx_mode;
+ to->st_nlink = from->stx_nlink;
+ to->st_uid = from->stx_uid;
+ to->st_gid = from->stx_gid;
+ to->st_atime = from->stx_atime.tv_sec;
+ to->st_atim.tv_nsec = from->stx_atime.tv_nsec;
+ to->st_mtime = from->stx_mtime.tv_sec;
+ to->st_mtim.tv_nsec = from->stx_mtime.tv_nsec;
+ to->st_ctime = from->stx_ctime.tv_sec;
+ to->st_ctim.tv_nsec = from->stx_ctime.tv_nsec;
+ to->st_size = from->stx_size;
+ to->st_blocks = from->stx_blocks;
+ to->st_blksize = from->stx_blksize;
+}
new file mode 100644
@@ -0,0 +1,51 @@
+/* xstat implemented with statx system call. C-SKY version.
+ Copyright (C) 2018 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+#if !XSTAT_IS_XSTAT64
+#include "overflow.h"
+
+extern void __cp_stat_statx (struct stat *to, struct statx *from);
+
+/* Get information about the file NAME in BUF. */
+int
+__xstat (int vers, const char *name, struct stat *buf)
+{
+ if (vers == _STAT_VER_KERNEL)
+ {
+ struct statx tmp;
+ int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, name, AT_NO_AUTOMOUNT,
+ STATX_BASIC_STATS, &tmp);
+ __cp_stat_statx (buf, &tmp);
+ return rc;
+ }
+
+ errno = EINVAL;
+ return -1;
+}
+hidden_def (__xstat)
+#endif
new file mode 100644
@@ -0,0 +1,60 @@
+/* xstat64 implemented with statx system call. C-SKY version.
+ Copyright (C) 2018 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
+ <http://www.gnu.org/licenses/>. */
+
+/* Hide the prototype for __xstat so that GCC will not complain about
+ the different function signature if it is aliased to __xstat64.
+ If XSTAT_IS_XSTAT64 is set to non-zero then the stat and stat64
+ structures have an identical layout but different type names. */
+
+#define __xstat __xstat_disable
+
+#include <errno.h>
+#include <stddef.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+extern void __cp_stat64_statx (struct stat64 *to, struct statx *from);
+
+/* Get information about the file NAME in BUF. */
+int
+__xstat64 (int vers, const char *name, struct stat64 *buf)
+{
+ int ret;
+ struct statx tmp;
+ if (vers == _STAT_VER_KERNEL)
+ {
+ ret = INLINE_SYSCALL (statx, 5, AT_FDCWD, name, AT_NO_AUTOMOUNT,
+ STATX_BASIC_STATS, &tmp);
+ __cp_stat64_statx (buf, &tmp);
+ return ret;
+ }
+
+ errno = EINVAL;
+ return -1;
+}
+hidden_def (__xstat64)
+
+#undef __xstat
+#if XSTAT_IS_XSTAT64
+strong_alias (__xstat64, __xstat)
+hidden_ver (__xstat64, __xstat)
+#endif