summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/fstat.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2019-10-23 13:57:27 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2020-02-03 11:50:54 +0100
commit8a04c4d84c8a1a1297ec0c5cec5522112981e0c0 (patch)
tree80f637db2009956f5c5bfad7f413580af466e3e5 /libc/sysdeps/linux/common/fstat.c
parent6b21a5a5bd895e16ef57c4d0d89c806b2e0c22e8 (diff)
csky: add statx conditionals
Similar to glibc commit https://sourceware.org/git/?p=glibc.git;a=commit;h=6bbfc5c09fc5b5e3d4a0cddbbd4e2e457767dae7 we need to handle Linux kernel change, which removed stat64 family from default syscall set. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de>
Diffstat (limited to 'libc/sysdeps/linux/common/fstat.c')
-rw-r--r--libc/sysdeps/linux/common/fstat.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c
index 030360dfc..0b2798ad4 100644
--- a/libc/sysdeps/linux/common/fstat.c
+++ b/libc/sysdeps/linux/common/fstat.c
@@ -29,6 +29,20 @@ int fstat(int fd, struct stat *buf)
}
libc_hidden_def(fstat)
+#elif __NR_statx && defined __UCLIBC_HAVE_STATX__
+# include <fcntl.h>
+# include <statx_cp.h>
+
+int fstat(int fd, struct stat *buf)
+{
+ struct statx tmp;
+ int rc = INLINE_SYSCALL (statx, 5, fd, "", AT_EMPTY_PATH,
+ STATX_BASIC_STATS, &tmp);
+ if (rc == 0)
+ __cp_stat_statx ((struct stat *)buf, &tmp);
+}
+libc_hidden_def(fstat)
+
#elif defined __NR_fstat
int fstat(int fd, struct stat *buf)
{
@@ -57,7 +71,7 @@ int fstat(int fd, struct stat *buf)
libc_hidden_def(fstat)
#endif
-# if ! defined __NR_fstat64
+# if ! defined __NR_fstat64 && ! defined __UCLIBC_HAVE_STATX__
strong_alias_untyped(fstat,fstat64)
libc_hidden_def(fstat64)
#endif