linux: Always define STAT_IS_KERNEL_STAT

It allows to check for its value instead of its existence.

Checked with a build for all affected ABIS.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
Adhemerval Zanella 2020-07-15 12:42:32 +00:00
parent c71d13a098
commit 90e1600f4f
14 changed files with 15 additions and 7 deletions

View File

@ -85,5 +85,6 @@ struct glibc21_stat
long __glibc_reserved[4];
};
#define STAT_IS_KERNEL_STAT 0
#define XSTAT_IS_XSTAT64 1
#define STATFS_IS_STATFS64 0

View File

@ -38,7 +38,7 @@ __fxstat (int vers, int fd, struct stat *buf)
if (vers == _STAT_VER_KERNEL)
return INLINE_SYSCALL (fstat, 2, fd, buf);
#ifdef STAT_IS_KERNEL_STAT
#if STAT_IS_KERNEL_STAT
return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
#else
struct kernel_stat kbuf;

View File

@ -37,7 +37,7 @@ int
__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
{
int result;
#ifdef STAT_IS_KERNEL_STAT
#if STAT_IS_KERNEL_STAT
# define kst (*st)
#else
struct kernel_stat kst;
@ -46,7 +46,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
result = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag);
if (!__glibc_likely (INTERNAL_SYSCALL_ERROR_P (result)))
{
#ifdef STAT_IS_KERNEL_STAT
#if STAT_IS_KERNEL_STAT
return 0;
#else
return __xstat_conv (vers, &kst, st);

View File

@ -30,5 +30,6 @@ struct kernel_stat {
#define _HAVE_STAT_NSEC
#define _HAVE_STAT64_NSEC
#define STAT_IS_KERNEL_STAT 0
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0

View File

@ -34,5 +34,6 @@ struct kernel_stat
#define _HAVE_STAT64___ST_INO
#define _HAVE_STAT64_NSEC
#define STAT_IS_KERNEL_STAT 0
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0

View File

@ -37,7 +37,7 @@ __lxstat (int vers, const char *name, struct stat *buf)
if (vers == _STAT_VER_KERNEL)
return INLINE_SYSCALL (lstat, 2, name, buf);
#ifdef STAT_IS_KERNEL_STAT
#if STAT_IS_KERNEL_STAT
return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
#else
struct kernel_stat kbuf;

View File

@ -48,5 +48,6 @@ struct kernel_stat
#define _HAVE_STAT64___UNUSED5
};
#define STAT_IS_KERNEL_STAT 0
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0

View File

@ -56,5 +56,6 @@ struct kernel_stat
};
#endif
#define STAT_IS_KERNEL_STAT 0
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0

View File

@ -47,5 +47,6 @@ struct kernel_stat
#define _HAVE_STAT64___PAD2
#define _HAVE_STAT64_NSEC
#define STAT_IS_KERNEL_STAT 0
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0

View File

@ -31,5 +31,6 @@ struct kernel_stat
#define _HAVE_STAT_NSEC
#define _HAVE_STAT64_NSEC
#define STAT_IS_KERNEL_STAT 0
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0

View File

@ -44,5 +44,6 @@ struct kernel_stat64
long int __glibc_reserved[3];
};
#define STAT_IS_KERNEL_STAT 0
#define XSTAT_IS_XSTAT64 1
#define STATFS_IS_STATFS64 0

View File

@ -37,7 +37,7 @@ __xstat (int vers, const char *name, struct stat *buf)
if (vers == _STAT_VER_KERNEL)
return INLINE_SYSCALL (stat, 2, name, buf);
#ifdef STAT_IS_KERNEL_STAT
#if STAT_IS_KERNEL_STAT
return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
#else
struct kernel_stat kbuf;

View File

@ -20,7 +20,7 @@
#include <sys/stat.h>
#include <kernel_stat.h>
#ifdef STAT_IS_KERNEL_STAT
#if STAT_IS_KERNEL_STAT
/* Dummy. */
struct kernel_stat;

View File

@ -16,7 +16,7 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#ifndef STAT_IS_KERNEL_STAT
#if !STAT_IS_KERNEL_STAT
extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
attribute_hidden;
extern int __xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf)