mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
Add the statx function
This commit is contained in:
parent
b444e8f7cc
commit
fd70af4552
26
ChangeLog
26
ChangeLog
@ -1,3 +1,29 @@
|
||||
2018-07-10 Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
* io/Makefile (routines): Add statx.
|
||||
(tests-internal): Add tst-statx.
|
||||
* io/Versions (GLIBC_2.28): Export statx.
|
||||
* io/bits/statx.h: New file.
|
||||
* io/sys/stat.h [__USE_GNU]: Include it.
|
||||
* io/fcntl.h [__USE_GNU] (AT_STATX_SYNC_TYPE)
|
||||
(AT_STATX_SYNC_AS_STAT, AT_STATX_FORCE_SYNC, AT_STATX_DONT_SYNC):
|
||||
Define.
|
||||
* io/statx.c: New file.
|
||||
* io/statx_generic.: Likewise.
|
||||
* io/tst-statx.: Likewise.
|
||||
* include/bits/statx.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/kernel-features.h
|
||||
[__LINUX_KERNEL_VERSION >= 0x040B00] (__ASSUME_STATX): Define.
|
||||
* sysdeps/unix/sysv/linux/alpha/kernel-features.h
|
||||
[__LINUX_KERNEL_VERSION < 0x040D00] (__ASSUME_STATX): Undefine.
|
||||
* sysdeps/unix/sysv/linux/ia64/kernel-features.h (__ASSUME_STATX):
|
||||
Undefine.
|
||||
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
|
||||
[__LINUX_KERNEL_VERSION < 0x040C00] (__ASSUME_STATX): Undefine.
|
||||
* sysdeps/unix/sysv/linux/statx.c: New file.
|
||||
* manual/filesys.texi: Note that statx is undocumented.
|
||||
* sysdeps/**/libc*.abilist: Update.
|
||||
|
||||
2018-07-10 Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
|
||||
* sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c: Add a comment about
|
||||
|
5
NEWS
5
NEWS
@ -55,6 +55,11 @@ Major new features:
|
||||
flags and a non-existing destination (and therefore has a race condition
|
||||
that can clobber the destination inadvertently).
|
||||
|
||||
* The statx function has been added, a variant of the fstatat64
|
||||
function with an additional flags argument. If there is no direct
|
||||
kernel support for statx, glibc provides basic stat support based on
|
||||
the fstatat64 function.
|
||||
|
||||
* IDN domain names in getaddrinfo and getnameinfo now use the system libidn2
|
||||
library if installed. libidn2 version 2.0.5 or later is recommended. If
|
||||
libidn2 is not available, internationalized domain names are not encoded
|
||||
|
1
include/bits/statx.h
Normal file
1
include/bits/statx.h
Normal file
@ -0,0 +1 @@
|
||||
#include <io/bits/statx.h>
|
@ -31,7 +31,7 @@ routines := \
|
||||
utime \
|
||||
mkfifo mkfifoat \
|
||||
stat fstat lstat stat64 fstat64 lstat64 fstatat fstatat64 \
|
||||
xstat fxstat lxstat xstat64 fxstat64 lxstat64 \
|
||||
xstat fxstat lxstat xstat64 fxstat64 lxstat64 statx \
|
||||
mknod mknodat xmknod xmknodat \
|
||||
fxstatat fxstatat64 \
|
||||
statfs fstatfs statfs64 fstatfs64 \
|
||||
@ -78,6 +78,9 @@ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
|
||||
tests-static += tst-copy_file_range-compat
|
||||
tests-internal += tst-copy_file_range-compat
|
||||
|
||||
# Likewise for statx, but we do not need static linking here.
|
||||
tests-internal += tst-statx
|
||||
|
||||
ifeq ($(run-built-tests),yes)
|
||||
tests-special += $(objpfx)ftwtest.out
|
||||
endif
|
||||
|
@ -130,6 +130,7 @@ libc {
|
||||
}
|
||||
GLIBC_2.28 {
|
||||
fcntl64;
|
||||
statx;
|
||||
}
|
||||
GLIBC_PRIVATE {
|
||||
__libc_fcntl64;
|
||||
|
91
io/bits/statx.h
Normal file
91
io/bits/statx.h
Normal file
@ -0,0 +1,91 @@
|
||||
/* statx-related definitions and declarations.
|
||||
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/>. */
|
||||
|
||||
/* This interface is based on <linux/stat.h> in Linux. */
|
||||
|
||||
#ifndef _SYS_STAT_H
|
||||
# error Never include <bits/stat.x.h> directly, include <sys/stat.h> instead.
|
||||
#endif
|
||||
|
||||
struct statx_timestamp
|
||||
{
|
||||
__int64_t tv_sec;
|
||||
__uint32_t tv_nsec;
|
||||
__int32_t __statx_timestamp_pad1[1];
|
||||
};
|
||||
|
||||
/* Warning: The kernel may add additional fields to this struct in the
|
||||
future. Only use this struct for calling the statx function, not
|
||||
for storing data. (Expansion will be controlled by the mask
|
||||
argument of the statx function.) */
|
||||
struct statx
|
||||
{
|
||||
__uint32_t stx_mask;
|
||||
__uint32_t stx_blksize;
|
||||
__uint64_t stx_attributes;
|
||||
__uint32_t stx_nlink;
|
||||
__uint32_t stx_uid;
|
||||
__uint32_t stx_gid;
|
||||
__uint16_t stx_mode;
|
||||
__uint16_t __statx_pad1[1];
|
||||
__uint64_t stx_ino;
|
||||
__uint64_t stx_size;
|
||||
__uint64_t stx_blocks;
|
||||
__uint64_t stx_attributes_mask;
|
||||
struct statx_timestamp stx_atime;
|
||||
struct statx_timestamp stx_btime;
|
||||
struct statx_timestamp stx_ctime;
|
||||
struct statx_timestamp stx_mtime;
|
||||
__uint32_t stx_rdev_major;
|
||||
__uint32_t stx_rdev_minor;
|
||||
__uint32_t stx_dev_major;
|
||||
__uint32_t stx_dev_minor;
|
||||
__uint64_t __statx_pad2[14];
|
||||
};
|
||||
|
||||
#define STATX_TYPE 0x0001U
|
||||
#define STATX_MODE 0x0002U
|
||||
#define STATX_NLINK 0x0004U
|
||||
#define STATX_UID 0x0008U
|
||||
#define STATX_GID 0x0010U
|
||||
#define STATX_ATIME 0x0020U
|
||||
#define STATX_MTIME 0x0040U
|
||||
#define STATX_CTIME 0x0080U
|
||||
#define STATX_INO 0x0100U
|
||||
#define STATX_SIZE 0x0200U
|
||||
#define STATX_BLOCKS 0x0400U
|
||||
#define STATX_BASIC_STATS 0x07ffU
|
||||
#define STATX_ALL 0x0fffU
|
||||
#define STATX_BTIME 0x0800U
|
||||
#define STATX__RESERVED 0x80000000U
|
||||
|
||||
#define STATX_ATTR_COMPRESSED 0x0004
|
||||
#define STATX_ATTR_IMMUTABLE 0x0010
|
||||
#define STATX_ATTR_APPEND 0x0020
|
||||
#define STATX_ATTR_NODUMP 0x0040
|
||||
#define STATX_ATTR_ENCRYPTED 0x0800
|
||||
#define STATX_ATTR_AUTOMOUNT 0x1000
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Fill *BUF with information about PATH in DIRFD. */
|
||||
int statx (int __dirfd, const char *__restrict __path, int __flags,
|
||||
unsigned int __mask, struct statx *__restrict __buf)
|
||||
__THROW __nonnull ((2, 5));
|
||||
|
||||
__END_DECLS
|
@ -157,6 +157,10 @@ typedef __pid_t pid_t;
|
||||
# define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount
|
||||
traversal. */
|
||||
# define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname. */
|
||||
# define AT_STATX_SYNC_TYPE 0x6000
|
||||
# define AT_STATX_SYNC_AS_STAT 0x0000
|
||||
# define AT_STATX_FORCE_SYNC 0x2000
|
||||
# define AT_STATX_DONT_SYNC 0x4000
|
||||
# endif
|
||||
# define AT_EACCESS 0x200 /* Test access permitted for
|
||||
effective IDs, not real IDs. */
|
||||
|
29
io/statx.c
Normal file
29
io/statx.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* Generic 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)
|
||||
{
|
||||
return statx_generic (fd, path, flags, mask, buf);
|
||||
}
|
81
io/statx_generic.c
Normal file
81
io/statx_generic.c
Normal file
@ -0,0 +1,81 @@
|
||||
/* Generic implementation of statx based on fstatat64.
|
||||
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 <sys/stat.h>
|
||||
#include <sys/sysmacros.h>
|
||||
|
||||
static inline struct statx_timestamp
|
||||
statx_convert_timestamp (struct timespec tv)
|
||||
{
|
||||
return (struct statx_timestamp) { tv.tv_sec, tv.tv_nsec };
|
||||
}
|
||||
|
||||
/* Approximate emulation of statx. This will always fill in
|
||||
POSIX-mandated attributes even if the underlying file system does
|
||||
not actually support it (for example, GID and UID on file systems
|
||||
without UNIX-style permissions). */
|
||||
static __attribute__ ((unused)) int
|
||||
statx_generic (int fd, const char *path, int flags,
|
||||
unsigned int mask, struct statx *buf)
|
||||
{
|
||||
/* Flags which need to be cleared before passing them to
|
||||
fstatat64. */
|
||||
static const int clear_flags = AT_STATX_SYNC_AS_STAT;
|
||||
|
||||
/* Flags supported by our emulation. */
|
||||
static const int supported_flags
|
||||
= AT_EMPTY_PATH | AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW | clear_flags;
|
||||
|
||||
if (__glibc_unlikely ((flags & ~supported_flags) != 0))
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct stat64 st;
|
||||
int ret = __fstatat64 (fd, path, &st, flags & ~clear_flags);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
/* The interface is defined in such a way that unused (padding)
|
||||
fields have to be cleared. STATX_BASIC_STATS corresponds to the
|
||||
data which is available via fstatat64. */
|
||||
*buf = (struct statx)
|
||||
{
|
||||
.stx_mask = STATX_BASIC_STATS,
|
||||
.stx_blksize = st.st_blksize,
|
||||
.stx_nlink = st.st_nlink,
|
||||
.stx_uid = st.st_uid,
|
||||
.stx_gid = st.st_gid,
|
||||
.stx_mode = st.st_mode,
|
||||
.stx_ino = st.st_ino,
|
||||
.stx_size = st.st_size,
|
||||
.stx_blocks = st.st_blocks,
|
||||
.stx_atime = statx_convert_timestamp (st.st_atim),
|
||||
.stx_ctime = statx_convert_timestamp (st.st_ctim),
|
||||
.stx_mtime = statx_convert_timestamp (st.st_mtim),
|
||||
.stx_rdev_major = major (st.st_rdev),
|
||||
.stx_rdev_minor = minor (st.st_rdev),
|
||||
.stx_dev_major = major (st.st_dev),
|
||||
.stx_dev_minor = minor (st.st_dev),
|
||||
};
|
||||
|
||||
return 0;
|
||||
}
|
@ -442,6 +442,10 @@ extern int __xmknodat (int __ver, int __fd, const char *__path,
|
||||
__mode_t __mode, __dev_t *__dev)
|
||||
__THROW __nonnull ((3, 5));
|
||||
|
||||
#ifdef __USE_GNU
|
||||
# include <bits/statx.h>
|
||||
#endif
|
||||
|
||||
#ifdef __USE_EXTERN_INLINES
|
||||
/* Inlined versions of the real stat and mknod functions. */
|
||||
|
||||
|
157
io/tst-statx.c
Normal file
157
io/tst-statx.c
Normal file
@ -0,0 +1,157 @@
|
||||
/* Basic test of statx system call.
|
||||
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 <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <support/check.h>
|
||||
#include <support/support.h>
|
||||
#include <support/temp_file.h>
|
||||
#include <support/xunistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Ensure that the types have the kernel-expected layout. */
|
||||
_Static_assert (sizeof (struct statx_timestamp) == 16, "statx_timestamp size");
|
||||
_Static_assert (sizeof (struct statx) == 256, "statx size");
|
||||
_Static_assert (offsetof (struct statx, stx_nlink) == 16, "statx nlink");
|
||||
_Static_assert (offsetof (struct statx, stx_ino) == 32, "statx ino");
|
||||
_Static_assert (offsetof (struct statx, stx_atime) == 64, "statx atime");
|
||||
_Static_assert (offsetof (struct statx, stx_rdev_major) == 128, "statx rdev");
|
||||
_Static_assert (offsetof (struct statx, __statx_pad2) == 144, "statx pad2");
|
||||
|
||||
#include "statx_generic.c"
|
||||
|
||||
typedef int (*statx_function) (int, const char *, int, unsigned int,
|
||||
struct statx *);
|
||||
|
||||
/* Return true if we have a real implementation of statx. */
|
||||
static bool
|
||||
kernel_supports_statx (void)
|
||||
{
|
||||
#ifdef __NR_statx
|
||||
struct statx buf;
|
||||
return syscall (__NR_statx, 0, "", AT_EMPTY_PATH, 0, &buf) == 0
|
||||
|| errno != ENOSYS;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Tests which apply to both implementations. */
|
||||
static void
|
||||
both_implementations_tests (statx_function impl, const char *path, int fd)
|
||||
{
|
||||
uint64_t ino;
|
||||
{
|
||||
struct statx buf = { 0, };
|
||||
TEST_COMPARE (statx (fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS, &buf), 0);
|
||||
TEST_COMPARE (buf.stx_size, 3);
|
||||
ino = buf.stx_ino;
|
||||
}
|
||||
{
|
||||
struct statx buf = { 0, };
|
||||
TEST_COMPARE (statx (AT_FDCWD, path, 0, STATX_BASIC_STATS, &buf), 0);
|
||||
TEST_COMPARE (buf.stx_size, 3);
|
||||
TEST_COMPARE (buf.stx_ino, ino);
|
||||
}
|
||||
{
|
||||
struct statx stx = { 0, };
|
||||
TEST_COMPARE (statx (fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS, &stx), 0);
|
||||
struct stat64 st;
|
||||
xfstat (fd, &st);
|
||||
TEST_COMPARE (stx.stx_mode, st.st_mode);
|
||||
TEST_COMPARE (stx.stx_dev_major, major (st.st_dev));
|
||||
TEST_COMPARE (stx.stx_dev_minor, minor (st.st_dev));
|
||||
}
|
||||
{
|
||||
struct statx stx = { 0, };
|
||||
TEST_COMPARE (statx (AT_FDCWD, "/dev/null", 0, STATX_BASIC_STATS, &stx),
|
||||
0);
|
||||
struct stat64 st;
|
||||
xstat ("/dev/null", &st);
|
||||
TEST_COMPARE (stx.stx_mode, st.st_mode);
|
||||
TEST_COMPARE (stx.stx_dev_major, major (st.st_dev));
|
||||
TEST_COMPARE (stx.stx_dev_minor, minor (st.st_dev));
|
||||
TEST_COMPARE (stx.stx_rdev_major, major (st.st_rdev));
|
||||
TEST_COMPARE (stx.stx_rdev_minor, minor (st.st_rdev));
|
||||
}
|
||||
}
|
||||
|
||||
/* Tests which apply only to the non-kernel (generic)
|
||||
implementation. */
|
||||
static void
|
||||
non_kernel_tests (statx_function impl, int fd)
|
||||
{
|
||||
/* The non-kernel implementation must always fail for explicit sync
|
||||
flags. */
|
||||
struct statx buf;
|
||||
errno = 0;
|
||||
TEST_COMPARE (impl (fd, "", AT_EMPTY_PATH | AT_STATX_FORCE_SYNC,
|
||||
STATX_BASIC_STATS, &buf), -1);
|
||||
TEST_COMPARE (errno, EINVAL);
|
||||
errno = 0;
|
||||
TEST_COMPARE (impl (fd, "", AT_EMPTY_PATH | AT_STATX_DONT_SYNC,
|
||||
STATX_BASIC_STATS, &buf), -1);
|
||||
TEST_COMPARE (errno, EINVAL);
|
||||
}
|
||||
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
char *path;
|
||||
int fd = create_temp_file ("tst-statx-", &path);
|
||||
TEST_VERIFY_EXIT (fd >= 0);
|
||||
support_write_file_string (path, "abc");
|
||||
|
||||
both_implementations_tests (&statx, path, fd);
|
||||
both_implementations_tests (&statx_generic, path, fd);
|
||||
|
||||
if (kernel_supports_statx ())
|
||||
{
|
||||
puts ("info: kernel supports statx");
|
||||
struct statx buf;
|
||||
buf.stx_size = 0;
|
||||
TEST_COMPARE (statx (fd, "", AT_EMPTY_PATH | AT_STATX_FORCE_SYNC,
|
||||
STATX_BASIC_STATS, &buf),
|
||||
0);
|
||||
TEST_COMPARE (buf.stx_size, 3);
|
||||
buf.stx_size = 0;
|
||||
TEST_COMPARE (statx (fd, "", AT_EMPTY_PATH | AT_STATX_DONT_SYNC,
|
||||
STATX_BASIC_STATS, &buf),
|
||||
0);
|
||||
TEST_COMPARE (buf.stx_size, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
puts ("info: kernel does not support statx");
|
||||
non_kernel_tests (&statx, fd);
|
||||
}
|
||||
non_kernel_tests (&statx_generic, fd);
|
||||
|
||||
xclose (fd);
|
||||
free (path);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
@ -3545,6 +3545,7 @@ The @code{mkdtemp} function comes from OpenBSD.
|
||||
@c fchownat
|
||||
@c futimesat
|
||||
@c fstatat (there's a commented-out safety assessment for this one)
|
||||
@c statx
|
||||
@c mkdirat
|
||||
@c mkfifoat
|
||||
@c name_to_handle_at
|
||||
|
@ -2035,6 +2035,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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
41
sysdeps/unix/sysv/linux/statx.c
Normal file
41
sysdeps/unix/sysv/linux/statx.c
Normal file
@ -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
|
||||
}
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user