diff options
author | Florian Weimer <fweimer@redhat.com> | 2018-07-10 16:14:45 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2018-07-10 16:14:45 +0200 |
commit | fd70af45528d59a00eb3190ef6706cb299488fcd (patch) | |
tree | 9782185e343e716c4af641cc16ece3ffd5c38ebf /sysdeps/unix | |
parent | b444e8f7cc40265c9a20ce5de5f3f6795b7f5028 (diff) |
Add the statx function
Diffstat (limited to 'sysdeps/unix')
31 files changed, 85 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist index 7a272a19bb..e92cd0ab9e 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist @@ -2133,3 +2133,4 @@ GLIBC_2.27 wcstof64x F GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h index 5781cffd5a..f63be39d1b 100644 --- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h +++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h @@ -45,4 +45,9 @@ # undef __ASSUME_EXECVEAT #endif +/* Support for statx was added in kernel 4.13. */ +#if __LINUX_KERNEL_VERSION < 0x040D00 +# undef __ASSUME_STATX +#endif + #endif /* _KERNEL_FEATURES_H */ diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist index 23fec55d97..ba9473940a 100644 --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist @@ -2028,6 +2028,7 @@ GLIBC_2.27 wcstof64x F GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist index b203160889..dc71f1bb7f 100644 --- a/sysdeps/unix/sysv/linux/arm/libc.abilist +++ b/sysdeps/unix/sysv/linux/arm/libc.abilist @@ -118,6 +118,7 @@ GLIBC_2.27 wcstof64_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.4 _Exit F GLIBC_2.4 _IO_2_1_stderr_ D 0xa0 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0 diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist index 64809ca403..6a34090733 100644 --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist @@ -1875,6 +1875,7 @@ GLIBC_2.27 wcstof64_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist index 4a87f62ad9..30f8ddc682 100644 --- a/sysdeps/unix/sysv/linux/i386/libc.abilist +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist @@ -2040,6 +2040,7 @@ GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/ia64/kernel-features.h b/sysdeps/unix/sysv/linux/ia64/kernel-features.h index 04cdf43511..4fde73fba1 100644 --- a/sysdeps/unix/sysv/linux/ia64/kernel-features.h +++ b/sysdeps/unix/sysv/linux/ia64/kernel-features.h @@ -26,6 +26,9 @@ #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_ACCEPT4_SYSCALL 1 +/* No statx system call on ia64 yet. */ +#undef __ASSUME_STATX + #undef __ASSUME_CLONE_DEFAULT #define __ASSUME_CLONE2 diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist index 6bdd0d0443..8f7aaff388 100644 --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist @@ -1909,6 +1909,7 @@ GLIBC_2.27 wcstof64x F GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 86fc66574b..5543d92d7e 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -115,6 +115,11 @@ # define __ASSUME_COPY_FILE_RANGE 1 #endif +/* Support for statx was added in kernel 4.11. */ +#if __LINUX_KERNEL_VERSION >= 0x040B00 +# define __ASSUME_STATX 1 +#endif + /* Support for clone call used on fork. The signature varies across the architectures with current 4 different variants: diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist index 3226f916eb..1b057ec6a6 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist @@ -119,6 +119,7 @@ GLIBC_2.27 wcstof64_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.4 _Exit F GLIBC_2.4 _IO_2_1_stderr_ D 0x98 GLIBC_2.4 _IO_2_1_stdin_ D 0x98 diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist index b1074eeed1..70232f2d16 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist @@ -1984,6 +1984,7 @@ GLIBC_2.27 wcstof64_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h index 7db3d05636..e8e2ac6a87 100644 --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h @@ -63,5 +63,10 @@ # undef __ASSUME_COPY_FILE_RANGE #endif +/* Support for statx was added in kernel 4.12. */ +#if __LINUX_KERNEL_VERSION < 0X040C00 +# undef __ASSUME_STATX +#endif + #undef __ASSUME_CLONE_DEFAULT #define __ASSUME_CLONE_BACKWARDS3 diff --git a/sysdeps/unix/sysv/linux/microblaze/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/libc.abilist index b52fc7d6f7..6f295789c6 100644 --- a/sysdeps/unix/sysv/linux/microblaze/libc.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/libc.abilist @@ -2125,3 +2125,4 @@ GLIBC_2.27 wcstof64_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist index 718c74262a..88f79b7d9d 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist @@ -1962,6 +1962,7 @@ GLIBC_2.27 wcstof64_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist index 9b218a9435..563b3101b7 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist @@ -1960,6 +1960,7 @@ GLIBC_2.27 wcstof64_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist index 5a90ab83e7..5cdf8c2232 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist @@ -1968,6 +1968,7 @@ GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist index 3005fc9500..ce27832705 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist @@ -1963,6 +1963,7 @@ GLIBC_2.27 wcstof64x F GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist index a87fbbeb6b..78cc9cfff3 100644 --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist @@ -2166,3 +2166,4 @@ GLIBC_2.27 wcstof64_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist index d56f776a52..9ae40a9470 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist @@ -1988,6 +1988,7 @@ GLIBC_2.27 wcstof64_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist index 2b5337aab6..863f85b430 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist @@ -1992,6 +1992,7 @@ GLIBC_2.27 wcstof64_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist index d0dfde3897..4cc5a4473b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist @@ -2223,3 +2223,4 @@ GLIBC_2.27 wcstof64x F GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist index d505ae0e7d..a3cd3229c9 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist @@ -118,6 +118,7 @@ GLIBC_2.27 wcstof64 F GLIBC_2.27 wcstof64_l F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 _Exit F GLIBC_2.3 _IO_2_1_stderr_ D 0xe0 GLIBC_2.3 _IO_2_1_stdin_ D 0xe0 diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist index 33f751abc0..f094b0f3cd 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist @@ -2095,3 +2095,4 @@ GLIBC_2.27 xprt_register F GLIBC_2.27 xprt_unregister F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist index c4ec93ff43..26a95e6fda 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist @@ -1997,6 +1997,7 @@ GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist index 2a6a0abde8..650385b607 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist @@ -1902,6 +1902,7 @@ GLIBC_2.27 wcstof64x F GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist index 8de0d1711a..cd349ccec1 100644 --- a/sysdeps/unix/sysv/linux/sh/libc.abilist +++ b/sysdeps/unix/sysv/linux/sh/libc.abilist @@ -1879,6 +1879,7 @@ GLIBC_2.27 wcstof64_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist index 9858460c9f..e0438402b3 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist @@ -1991,6 +1991,7 @@ GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist index a22b8fb7ca..9f036ddf4b 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist @@ -1932,6 +1932,7 @@ GLIBC_2.27 wcstof64x F GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/statx.c b/sysdeps/unix/sysv/linux/statx.c new file mode 100644 index 0000000000..76761d6ef2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/statx.c @@ -0,0 +1,41 @@ +/* Linux statx implementation. + 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 <sys/stat.h> + +#include "statx_generic.c" + +int +statx (int fd, const char *path, int flags, + unsigned int mask, struct statx *buf) +{ +#ifdef __NR_statx + int ret = INLINE_SYSCALL_CALL (statx, fd, path, flags, mask, buf); +# ifdef __ASSUME_STATX + return ret; +# else + if (ret == 0 || errno != ENOSYS) + /* Preserve non-error/non-ENOSYS return values. */ + return ret; +# endif +#endif +#ifndef __ASSUME_STATX + return statx_generic (fd, path, flags, mask, buf); +#endif +} diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist index d5d71cccba..2df20ebafd 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist @@ -1890,6 +1890,7 @@ GLIBC_2.27 wcstof64x F GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F GLIBC_2.3 __ctype_b_loc F GLIBC_2.3 __ctype_tolower_loc F GLIBC_2.3 __ctype_toupper_loc F diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist index e6ad42440e..83e15f84fc 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist @@ -2141,3 +2141,4 @@ GLIBC_2.27 wcstof64x F GLIBC_2.27 wcstof64x_l F GLIBC_2.28 fcntl64 F GLIBC_2.28 renameat2 F +GLIBC_2.28 statx F |