diff mbox series

[02/10] linux: Set default kernel_stat.h to LFS

Message ID 20210208214936.1502047-3-adhemerval.zanella@linaro.org
State New
Headers show
Series stat[fs,vfs] consolidation | expand

Commit Message

Adhemerval Zanella Feb. 8, 2021, 9:49 p.m. UTC
The XSTAT_IS_XSTAT64 and STAT_IS_KERNEL_STAT flags are now set to 1 and
STATFS_IS_STATFS64 is set to __STATFS_MATCHES_STATFS64.  This makes the
default ABI for newer ports to provide only LFS calls.

A copy of non-LFS support is provided to 32-bit ABIS with non-LFS
support (arm, csky, i386, m68k, nios2, s390, and sh).  Is also allows
to remove the 64-bit ports, which already uses the default values.

This patch does not change the code generation.
---
 sysdeps/unix/sysv/linux/arc/kernel_stat.h     | 27 ---------
 sysdeps/unix/sysv/linux/arm/kernel_stat.h     | 40 +++++++++++++
 .../sysv/linux/{riscv => csky}/kernel_stat.h  | 12 ++--
 sysdeps/unix/sysv/linux/generic/kernel_stat.h | 30 ----------
 sysdeps/unix/sysv/linux/i386/kernel_stat.h    | 40 +++++++++++++
 sysdeps/unix/sysv/linux/ia64/kernel_stat.h    | 22 -------
 sysdeps/unix/sysv/linux/kernel_stat.h         | 58 +++++++------------
 sysdeps/unix/sysv/linux/m68k/kernel_stat.h    | 40 +++++++++++++
 .../linux/{aarch64 => nios2}/kernel_stat.h    |  9 +--
 .../linux/powerpc/powerpc64/kernel_stat.h     | 22 -------
 .../sysv/linux/s390/s390-32/kernel_stat.h     | 40 +++++++++++++
 .../sysv/linux/s390/s390-64/kernel_stat.h     | 22 -------
 sysdeps/unix/sysv/linux/sh/kernel_stat.h      | 40 +++++++++++++
 sysdeps/unix/sysv/linux/x86_64/kernel_stat.h  | 22 -------
 sysdeps/unix/sysv/linux/xstatconv.c           |  7 +--
 15 files changed, 231 insertions(+), 200 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/arc/kernel_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/arm/kernel_stat.h
 rename sysdeps/unix/sysv/linux/{riscv => csky}/kernel_stat.h (77%)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/kernel_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/i386/kernel_stat.h
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/kernel_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/m68k/kernel_stat.h
 rename sysdeps/unix/sysv/linux/{aarch64 => nios2}/kernel_stat.h (78%)
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h
 delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/sh/kernel_stat.h
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/kernel_stat.h

Comments

Carlos O'Donell Feb. 11, 2021, 12:37 a.m. UTC | #1
On 2/8/21 4:49 PM, Adhemerval Zanella via Libc-alpha wrote:
> The XSTAT_IS_XSTAT64 and STAT_IS_KERNEL_STAT flags are now set to 1 and
> STATFS_IS_STATFS64 is set to __STATFS_MATCHES_STATFS64.  This makes the
> default ABI for newer ports to provide only LFS calls.
> 
> A copy of non-LFS support is provided to 32-bit ABIS with non-LFS
> support (arm, csky, i386, m68k, nios2, s390, and sh).  Is also allows
> to remove the 64-bit ports, which already uses the default values.
> 
> This patch does not change the code generation.

This is also sane, and starts working towards LFS by default.

LGTM.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/arc/kernel_stat.h     | 27 ---------
>  sysdeps/unix/sysv/linux/arm/kernel_stat.h     | 40 +++++++++++++
>  .../sysv/linux/{riscv => csky}/kernel_stat.h  | 12 ++--
>  sysdeps/unix/sysv/linux/generic/kernel_stat.h | 30 ----------
>  sysdeps/unix/sysv/linux/i386/kernel_stat.h    | 40 +++++++++++++
>  sysdeps/unix/sysv/linux/ia64/kernel_stat.h    | 22 -------
>  sysdeps/unix/sysv/linux/kernel_stat.h         | 58 +++++++------------
>  sysdeps/unix/sysv/linux/m68k/kernel_stat.h    | 40 +++++++++++++
>  .../linux/{aarch64 => nios2}/kernel_stat.h    |  9 +--
>  .../linux/powerpc/powerpc64/kernel_stat.h     | 22 -------
>  .../sysv/linux/s390/s390-32/kernel_stat.h     | 40 +++++++++++++
>  .../sysv/linux/s390/s390-64/kernel_stat.h     | 22 -------
>  sysdeps/unix/sysv/linux/sh/kernel_stat.h      | 40 +++++++++++++
>  sysdeps/unix/sysv/linux/x86_64/kernel_stat.h  | 22 -------
>  sysdeps/unix/sysv/linux/xstatconv.c           |  7 +--
>  15 files changed, 231 insertions(+), 200 deletions(-)
>  delete mode 100644 sysdeps/unix/sysv/linux/arc/kernel_stat.h
>  create mode 100644 sysdeps/unix/sysv/linux/arm/kernel_stat.h
>  rename sysdeps/unix/sysv/linux/{riscv => csky}/kernel_stat.h (77%)
>  delete mode 100644 sysdeps/unix/sysv/linux/generic/kernel_stat.h
>  create mode 100644 sysdeps/unix/sysv/linux/i386/kernel_stat.h
>  delete mode 100644 sysdeps/unix/sysv/linux/ia64/kernel_stat.h
>  create mode 100644 sysdeps/unix/sysv/linux/m68k/kernel_stat.h
>  rename sysdeps/unix/sysv/linux/{aarch64 => nios2}/kernel_stat.h (78%)
>  delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h
>  create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h
>  delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h
>  create mode 100644 sysdeps/unix/sysv/linux/sh/kernel_stat.h
>  delete mode 100644 sysdeps/unix/sysv/linux/x86_64/kernel_stat.h
> 
> diff --git a/sysdeps/unix/sysv/linux/arc/kernel_stat.h b/sysdeps/unix/sysv/linux/arc/kernel_stat.h
> deleted file mode 100644
> index edd96b1b94..0000000000
> --- a/sysdeps/unix/sysv/linux/arc/kernel_stat.h
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -/* Copyright (C) 2020-2021 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
> -   <https://www.gnu.org/licenses/>.  */
> -
> -#include <bits/wordsize.h>
> -
> -/* Needed to elide the itemized copy code in common xstatconv.c.  */
> -#define STAT_IS_KERNEL_STAT 1
> -#define STAT64_IS_KERNEL_STAT64 1
> -
> -/* Nice side-effect of 64-bit time_t switch is these are same.  */
> -#define XSTAT_IS_XSTAT64 1
> -
> -#define STATFS_IS_STATFS64 0
> diff --git a/sysdeps/unix/sysv/linux/arm/kernel_stat.h b/sysdeps/unix/sysv/linux/arm/kernel_stat.h
> new file mode 100644
> index 0000000000..b1bc1459f0
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/arm/kernel_stat.h
> @@ -0,0 +1,40 @@
> +/* Definition of `struct stat' used in the kernel..  */
> +struct kernel_stat
> +  {
> +    unsigned short int st_dev;
> +    unsigned short int __pad1;
> +#define _HAVE___PAD1
> +    unsigned long int st_ino;
> +    unsigned short int st_mode;
> +    unsigned short int st_nlink;
> +    unsigned short int st_uid;
> +    unsigned short int st_gid;
> +    unsigned short int st_rdev;
> +    unsigned short int __pad2;
> +#define _HAVE___PAD2
> +    unsigned long int st_size;
> +    unsigned long int st_blksize;
> +    unsigned long int st_blocks;
> +    struct timespec st_atim;
> +    struct timespec st_mtim;
> +    struct timespec st_ctim;
> +    unsigned long int __glibc_reserved4;
> +#define _HAVE___UNUSED4
> +    unsigned long int __glibc_reserved5;
> +#define _HAVE___UNUSED5
> +  };
> +
> +#define _HAVE_STAT___UNUSED4
> +#define _HAVE_STAT___UNUSED5
> +#define _HAVE_STAT___PAD1
> +#define _HAVE_STAT___PAD2
> +#define _HAVE_STAT_NSEC
> +#define _HAVE_STAT64___PAD1
> +#define _HAVE_STAT64___PAD2
> +#define _HAVE_STAT64___ST_INO
> +#define _HAVE_STAT64_NSEC
> +
> +#define STAT_IS_KERNEL_STAT 0
> +#define STAT64_IS_KERNEL_STAT64 1
> +#define XSTAT_IS_XSTAT64 0
> +#define STATFS_IS_STATFS64 0
> diff --git a/sysdeps/unix/sysv/linux/riscv/kernel_stat.h b/sysdeps/unix/sysv/linux/csky/kernel_stat.h
> similarity index 77%
> rename from sysdeps/unix/sysv/linux/riscv/kernel_stat.h
> rename to sysdeps/unix/sysv/linux/csky/kernel_stat.h
> index 4ad7913762..e993021a81 100644
> --- a/sysdeps/unix/sysv/linux/riscv/kernel_stat.h
> +++ b/sysdeps/unix/sysv/linux/csky/kernel_stat.h
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2020-2021 Free Software Foundation, Inc.
> +/* Internal definitions for stat functions.  Linux/csky.
> +   Copyright (C) 2011-2021 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
> @@ -15,9 +16,6 @@
>     License along with the GNU C Library.  If not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#include <bits/wordsize.h>
> -
> -#define STAT_IS_KERNEL_STAT 1
> -
> -#define XSTAT_IS_XSTAT64 1
> -#define STATFS_IS_STATFS64 1
> +#define STAT_IS_KERNEL_STAT  1
> +#define XSTAT_IS_XSTAT64     0
> +#define STATFS_IS_STATFS64   0
> diff --git a/sysdeps/unix/sysv/linux/generic/kernel_stat.h b/sysdeps/unix/sysv/linux/generic/kernel_stat.h
> deleted file mode 100644
> index 350f0cc1bb..0000000000
> --- a/sysdeps/unix/sysv/linux/generic/kernel_stat.h
> +++ /dev/null
> @@ -1,30 +0,0 @@
> -/* Copyright (C) 2011-2021 Free Software Foundation, Inc.
> -   This file is part of the GNU C Library.
> -   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
> -
> -   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
> -   <https://www.gnu.org/licenses/>.  */
> -
> -#include <bits/wordsize.h>
> -
> -#define STAT_IS_KERNEL_STAT 1
> -
> -/* We provide separate 32-bit API versions that check for EOVERFLOW. */
> -#if __WORDSIZE == 64
> -# define XSTAT_IS_XSTAT64 1
> -#else
> -# define XSTAT_IS_XSTAT64 0
> -#endif
> -
> -#define STATFS_IS_STATFS64 0
> diff --git a/sysdeps/unix/sysv/linux/i386/kernel_stat.h b/sysdeps/unix/sysv/linux/i386/kernel_stat.h
> new file mode 100644
> index 0000000000..b1bc1459f0
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/i386/kernel_stat.h
> @@ -0,0 +1,40 @@
> +/* Definition of `struct stat' used in the kernel..  */
> +struct kernel_stat
> +  {
> +    unsigned short int st_dev;
> +    unsigned short int __pad1;
> +#define _HAVE___PAD1
> +    unsigned long int st_ino;
> +    unsigned short int st_mode;
> +    unsigned short int st_nlink;
> +    unsigned short int st_uid;
> +    unsigned short int st_gid;
> +    unsigned short int st_rdev;
> +    unsigned short int __pad2;
> +#define _HAVE___PAD2
> +    unsigned long int st_size;
> +    unsigned long int st_blksize;
> +    unsigned long int st_blocks;
> +    struct timespec st_atim;
> +    struct timespec st_mtim;
> +    struct timespec st_ctim;
> +    unsigned long int __glibc_reserved4;
> +#define _HAVE___UNUSED4
> +    unsigned long int __glibc_reserved5;
> +#define _HAVE___UNUSED5
> +  };
> +
> +#define _HAVE_STAT___UNUSED4
> +#define _HAVE_STAT___UNUSED5
> +#define _HAVE_STAT___PAD1
> +#define _HAVE_STAT___PAD2
> +#define _HAVE_STAT_NSEC
> +#define _HAVE_STAT64___PAD1
> +#define _HAVE_STAT64___PAD2
> +#define _HAVE_STAT64___ST_INO
> +#define _HAVE_STAT64_NSEC
> +
> +#define STAT_IS_KERNEL_STAT 0
> +#define STAT64_IS_KERNEL_STAT64 1
> +#define XSTAT_IS_XSTAT64 0
> +#define STATFS_IS_STATFS64 0
> diff --git a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h b/sysdeps/unix/sysv/linux/ia64/kernel_stat.h
> deleted file mode 100644
> index ee05a15590..0000000000
> --- a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -/* Definition of `struct stat' used in the kernel.
> -   Copyright (C) 2003-2021 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
> -   <https://www.gnu.org/licenses/>.  */
> -
> -#define STAT_IS_KERNEL_STAT 1
> -#define STAT64_IS_KERNEL_STAT64 1
> -#define XSTAT_IS_XSTAT64 1
> -#define STATFS_IS_STATFS64 1
> diff --git a/sysdeps/unix/sysv/linux/kernel_stat.h b/sysdeps/unix/sysv/linux/kernel_stat.h
> index b1bc1459f0..6c1b175cb4 100644
> --- a/sysdeps/unix/sysv/linux/kernel_stat.h
> +++ b/sysdeps/unix/sysv/linux/kernel_stat.h
> @@ -1,40 +1,22 @@
> -/* Definition of `struct stat' used in the kernel..  */
> -struct kernel_stat
> -  {
> -    unsigned short int st_dev;
> -    unsigned short int __pad1;
> -#define _HAVE___PAD1
> -    unsigned long int st_ino;
> -    unsigned short int st_mode;
> -    unsigned short int st_nlink;
> -    unsigned short int st_uid;
> -    unsigned short int st_gid;
> -    unsigned short int st_rdev;
> -    unsigned short int __pad2;
> -#define _HAVE___PAD2
> -    unsigned long int st_size;
> -    unsigned long int st_blksize;
> -    unsigned long int st_blocks;
> -    struct timespec st_atim;
> -    struct timespec st_mtim;
> -    struct timespec st_ctim;
> -    unsigned long int __glibc_reserved4;
> -#define _HAVE___UNUSED4
> -    unsigned long int __glibc_reserved5;
> -#define _HAVE___UNUSED5
> -  };
> +/* Internal definitions for stat functions.
> +   Copyright (C) 2021 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
>  
> -#define _HAVE_STAT___UNUSED4
> -#define _HAVE_STAT___UNUSED5
> -#define _HAVE_STAT___PAD1
> -#define _HAVE_STAT___PAD2
> -#define _HAVE_STAT_NSEC
> -#define _HAVE_STAT64___PAD1
> -#define _HAVE_STAT64___PAD2
> -#define _HAVE_STAT64___ST_INO
> -#define _HAVE_STAT64_NSEC
> +   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.
>  
> -#define STAT_IS_KERNEL_STAT 0
> -#define STAT64_IS_KERNEL_STAT64 1
> -#define XSTAT_IS_XSTAT64 0
> -#define STATFS_IS_STATFS64 0
> +   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
> +   <https://www.gnu.org/licenses/>.  */
> +
> +/* The default Linux ABI assumes only LFS support.  */
> +#define XSTAT_IS_XSTAT64     1
> +#define STATFS_IS_STATFS64   __STATFS_MATCHES_STATFS64
> +#define STAT_IS_KERNEL_STAT  1
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel_stat.h b/sysdeps/unix/sysv/linux/m68k/kernel_stat.h
> new file mode 100644
> index 0000000000..b1bc1459f0
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel_stat.h
> @@ -0,0 +1,40 @@
> +/* Definition of `struct stat' used in the kernel..  */
> +struct kernel_stat
> +  {
> +    unsigned short int st_dev;
> +    unsigned short int __pad1;
> +#define _HAVE___PAD1
> +    unsigned long int st_ino;
> +    unsigned short int st_mode;
> +    unsigned short int st_nlink;
> +    unsigned short int st_uid;
> +    unsigned short int st_gid;
> +    unsigned short int st_rdev;
> +    unsigned short int __pad2;
> +#define _HAVE___PAD2
> +    unsigned long int st_size;
> +    unsigned long int st_blksize;
> +    unsigned long int st_blocks;
> +    struct timespec st_atim;
> +    struct timespec st_mtim;
> +    struct timespec st_ctim;
> +    unsigned long int __glibc_reserved4;
> +#define _HAVE___UNUSED4
> +    unsigned long int __glibc_reserved5;
> +#define _HAVE___UNUSED5
> +  };
> +
> +#define _HAVE_STAT___UNUSED4
> +#define _HAVE_STAT___UNUSED5
> +#define _HAVE_STAT___PAD1
> +#define _HAVE_STAT___PAD2
> +#define _HAVE_STAT_NSEC
> +#define _HAVE_STAT64___PAD1
> +#define _HAVE_STAT64___PAD2
> +#define _HAVE_STAT64___ST_INO
> +#define _HAVE_STAT64_NSEC
> +
> +#define STAT_IS_KERNEL_STAT 0
> +#define STAT64_IS_KERNEL_STAT64 1
> +#define XSTAT_IS_XSTAT64 0
> +#define STATFS_IS_STATFS64 0
> diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel_stat.h b/sysdeps/unix/sysv/linux/nios2/kernel_stat.h
> similarity index 78%
> rename from sysdeps/unix/sysv/linux/aarch64/kernel_stat.h
> rename to sysdeps/unix/sysv/linux/nios2/kernel_stat.h
> index 33ad1b622b..1af30dab6f 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/kernel_stat.h
> +++ b/sysdeps/unix/sysv/linux/nios2/kernel_stat.h
> @@ -1,6 +1,7 @@
> -/* Internal definitions for stat functions.  Linux/AARch64 version.
> +/* Internal definitions for stat functions.  Linux/nios2.
>     Copyright (C) 2021 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
> +   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
>  
>     The GNU C Library is free software; you can redistribute it and/or
>     modify it under the terms of the GNU Lesser General Public
> @@ -16,6 +17,6 @@
>     License along with the GNU C Library.  If not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#define STAT_IS_KERNEL_STAT 1
> -#define XSTAT_IS_XSTAT64 1
> -#define STATFS_IS_STATFS64 1
> +#define STAT_IS_KERNEL_STAT  1
> +#define XSTAT_IS_XSTAT64     0
> +#define STATFS_IS_STATFS64   0
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h
> deleted file mode 100644
> index bc7390c9ff..0000000000
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -/* Definition of `struct stat' used in the kernel.
> -   Copyright (C) 2002-2021 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
> -   <https://www.gnu.org/licenses/>.  */
> -
> -#define STAT_IS_KERNEL_STAT 1
> -#define STAT64_IS_KERNEL_STAT64 1
> -#define XSTAT_IS_XSTAT64 1
> -#define STATFS_IS_STATFS64 1
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h b/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h
> new file mode 100644
> index 0000000000..b1bc1459f0
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h
> @@ -0,0 +1,40 @@
> +/* Definition of `struct stat' used in the kernel..  */
> +struct kernel_stat
> +  {
> +    unsigned short int st_dev;
> +    unsigned short int __pad1;
> +#define _HAVE___PAD1
> +    unsigned long int st_ino;
> +    unsigned short int st_mode;
> +    unsigned short int st_nlink;
> +    unsigned short int st_uid;
> +    unsigned short int st_gid;
> +    unsigned short int st_rdev;
> +    unsigned short int __pad2;
> +#define _HAVE___PAD2
> +    unsigned long int st_size;
> +    unsigned long int st_blksize;
> +    unsigned long int st_blocks;
> +    struct timespec st_atim;
> +    struct timespec st_mtim;
> +    struct timespec st_ctim;
> +    unsigned long int __glibc_reserved4;
> +#define _HAVE___UNUSED4
> +    unsigned long int __glibc_reserved5;
> +#define _HAVE___UNUSED5
> +  };
> +
> +#define _HAVE_STAT___UNUSED4
> +#define _HAVE_STAT___UNUSED5
> +#define _HAVE_STAT___PAD1
> +#define _HAVE_STAT___PAD2
> +#define _HAVE_STAT_NSEC
> +#define _HAVE_STAT64___PAD1
> +#define _HAVE_STAT64___PAD2
> +#define _HAVE_STAT64___ST_INO
> +#define _HAVE_STAT64_NSEC
> +
> +#define STAT_IS_KERNEL_STAT 0
> +#define STAT64_IS_KERNEL_STAT64 1
> +#define XSTAT_IS_XSTAT64 0
> +#define STATFS_IS_STATFS64 0
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h
> deleted file mode 100644
> index ee05a15590..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -/* Definition of `struct stat' used in the kernel.
> -   Copyright (C) 2003-2021 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
> -   <https://www.gnu.org/licenses/>.  */
> -
> -#define STAT_IS_KERNEL_STAT 1
> -#define STAT64_IS_KERNEL_STAT64 1
> -#define XSTAT_IS_XSTAT64 1
> -#define STATFS_IS_STATFS64 1
> diff --git a/sysdeps/unix/sysv/linux/sh/kernel_stat.h b/sysdeps/unix/sysv/linux/sh/kernel_stat.h
> new file mode 100644
> index 0000000000..b1bc1459f0
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sh/kernel_stat.h
> @@ -0,0 +1,40 @@
> +/* Definition of `struct stat' used in the kernel..  */
> +struct kernel_stat
> +  {
> +    unsigned short int st_dev;
> +    unsigned short int __pad1;
> +#define _HAVE___PAD1
> +    unsigned long int st_ino;
> +    unsigned short int st_mode;
> +    unsigned short int st_nlink;
> +    unsigned short int st_uid;
> +    unsigned short int st_gid;
> +    unsigned short int st_rdev;
> +    unsigned short int __pad2;
> +#define _HAVE___PAD2
> +    unsigned long int st_size;
> +    unsigned long int st_blksize;
> +    unsigned long int st_blocks;
> +    struct timespec st_atim;
> +    struct timespec st_mtim;
> +    struct timespec st_ctim;
> +    unsigned long int __glibc_reserved4;
> +#define _HAVE___UNUSED4
> +    unsigned long int __glibc_reserved5;
> +#define _HAVE___UNUSED5
> +  };
> +
> +#define _HAVE_STAT___UNUSED4
> +#define _HAVE_STAT___UNUSED5
> +#define _HAVE_STAT___PAD1
> +#define _HAVE_STAT___PAD2
> +#define _HAVE_STAT_NSEC
> +#define _HAVE_STAT64___PAD1
> +#define _HAVE_STAT64___PAD2
> +#define _HAVE_STAT64___ST_INO
> +#define _HAVE_STAT64_NSEC
> +
> +#define STAT_IS_KERNEL_STAT 0
> +#define STAT64_IS_KERNEL_STAT64 1
> +#define XSTAT_IS_XSTAT64 0
> +#define STATFS_IS_STATFS64 0
> diff --git a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h b/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h
> deleted file mode 100644
> index ee05a15590..0000000000
> --- a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -/* Definition of `struct stat' used in the kernel.
> -   Copyright (C) 2003-2021 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
> -   <https://www.gnu.org/licenses/>.  */
> -
> -#define STAT_IS_KERNEL_STAT 1
> -#define STAT64_IS_KERNEL_STAT64 1
> -#define XSTAT_IS_XSTAT64 1
> -#define STATFS_IS_STATFS64 1
> diff --git a/sysdeps/unix/sysv/linux/xstatconv.c b/sysdeps/unix/sysv/linux/xstatconv.c
> index 5dfe7c5fb5..4d049d4555 100644
> --- a/sysdeps/unix/sysv/linux/xstatconv.c
> +++ b/sysdeps/unix/sysv/linux/xstatconv.c
> @@ -21,12 +21,7 @@
>  #include <kernel_stat.h>
>  #include <sysdep.h>
>  
> -#if STAT_IS_KERNEL_STAT
> -
> -/* Dummy.  */
> -struct kernel_stat;
> -
> -#else
> +#if !STAT_IS_KERNEL_STAT
>  
>  #include <string.h>
>  
>
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/arc/kernel_stat.h b/sysdeps/unix/sysv/linux/arc/kernel_stat.h
deleted file mode 100644
index edd96b1b94..0000000000
--- a/sysdeps/unix/sysv/linux/arc/kernel_stat.h
+++ /dev/null
@@ -1,27 +0,0 @@ 
-/* Copyright (C) 2020-2021 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <bits/wordsize.h>
-
-/* Needed to elide the itemized copy code in common xstatconv.c.  */
-#define STAT_IS_KERNEL_STAT 1
-#define STAT64_IS_KERNEL_STAT64 1
-
-/* Nice side-effect of 64-bit time_t switch is these are same.  */
-#define XSTAT_IS_XSTAT64 1
-
-#define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/arm/kernel_stat.h b/sysdeps/unix/sysv/linux/arm/kernel_stat.h
new file mode 100644
index 0000000000..b1bc1459f0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/kernel_stat.h
@@ -0,0 +1,40 @@ 
+/* Definition of `struct stat' used in the kernel..  */
+struct kernel_stat
+  {
+    unsigned short int st_dev;
+    unsigned short int __pad1;
+#define _HAVE___PAD1
+    unsigned long int st_ino;
+    unsigned short int st_mode;
+    unsigned short int st_nlink;
+    unsigned short int st_uid;
+    unsigned short int st_gid;
+    unsigned short int st_rdev;
+    unsigned short int __pad2;
+#define _HAVE___PAD2
+    unsigned long int st_size;
+    unsigned long int st_blksize;
+    unsigned long int st_blocks;
+    struct timespec st_atim;
+    struct timespec st_mtim;
+    struct timespec st_ctim;
+    unsigned long int __glibc_reserved4;
+#define _HAVE___UNUSED4
+    unsigned long int __glibc_reserved5;
+#define _HAVE___UNUSED5
+  };
+
+#define _HAVE_STAT___UNUSED4
+#define _HAVE_STAT___UNUSED5
+#define _HAVE_STAT___PAD1
+#define _HAVE_STAT___PAD2
+#define _HAVE_STAT_NSEC
+#define _HAVE_STAT64___PAD1
+#define _HAVE_STAT64___PAD2
+#define _HAVE_STAT64___ST_INO
+#define _HAVE_STAT64_NSEC
+
+#define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 1
+#define XSTAT_IS_XSTAT64 0
+#define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/riscv/kernel_stat.h b/sysdeps/unix/sysv/linux/csky/kernel_stat.h
similarity index 77%
rename from sysdeps/unix/sysv/linux/riscv/kernel_stat.h
rename to sysdeps/unix/sysv/linux/csky/kernel_stat.h
index 4ad7913762..e993021a81 100644
--- a/sysdeps/unix/sysv/linux/riscv/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/csky/kernel_stat.h
@@ -1,4 +1,5 @@ 
-/* Copyright (C) 2020-2021 Free Software Foundation, Inc.
+/* Internal definitions for stat functions.  Linux/csky.
+   Copyright (C) 2011-2021 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
@@ -15,9 +16,6 @@ 
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <bits/wordsize.h>
-
-#define STAT_IS_KERNEL_STAT 1
-
-#define XSTAT_IS_XSTAT64 1
-#define STATFS_IS_STATFS64 1
+#define STAT_IS_KERNEL_STAT  1
+#define XSTAT_IS_XSTAT64     0
+#define STATFS_IS_STATFS64   0
diff --git a/sysdeps/unix/sysv/linux/generic/kernel_stat.h b/sysdeps/unix/sysv/linux/generic/kernel_stat.h
deleted file mode 100644
index 350f0cc1bb..0000000000
--- a/sysdeps/unix/sysv/linux/generic/kernel_stat.h
+++ /dev/null
@@ -1,30 +0,0 @@ 
-/* Copyright (C) 2011-2021 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
-
-   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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <bits/wordsize.h>
-
-#define STAT_IS_KERNEL_STAT 1
-
-/* We provide separate 32-bit API versions that check for EOVERFLOW. */
-#if __WORDSIZE == 64
-# define XSTAT_IS_XSTAT64 1
-#else
-# define XSTAT_IS_XSTAT64 0
-#endif
-
-#define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/i386/kernel_stat.h b/sysdeps/unix/sysv/linux/i386/kernel_stat.h
new file mode 100644
index 0000000000..b1bc1459f0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/kernel_stat.h
@@ -0,0 +1,40 @@ 
+/* Definition of `struct stat' used in the kernel..  */
+struct kernel_stat
+  {
+    unsigned short int st_dev;
+    unsigned short int __pad1;
+#define _HAVE___PAD1
+    unsigned long int st_ino;
+    unsigned short int st_mode;
+    unsigned short int st_nlink;
+    unsigned short int st_uid;
+    unsigned short int st_gid;
+    unsigned short int st_rdev;
+    unsigned short int __pad2;
+#define _HAVE___PAD2
+    unsigned long int st_size;
+    unsigned long int st_blksize;
+    unsigned long int st_blocks;
+    struct timespec st_atim;
+    struct timespec st_mtim;
+    struct timespec st_ctim;
+    unsigned long int __glibc_reserved4;
+#define _HAVE___UNUSED4
+    unsigned long int __glibc_reserved5;
+#define _HAVE___UNUSED5
+  };
+
+#define _HAVE_STAT___UNUSED4
+#define _HAVE_STAT___UNUSED5
+#define _HAVE_STAT___PAD1
+#define _HAVE_STAT___PAD2
+#define _HAVE_STAT_NSEC
+#define _HAVE_STAT64___PAD1
+#define _HAVE_STAT64___PAD2
+#define _HAVE_STAT64___ST_INO
+#define _HAVE_STAT64_NSEC
+
+#define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 1
+#define XSTAT_IS_XSTAT64 0
+#define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h b/sysdeps/unix/sysv/linux/ia64/kernel_stat.h
deleted file mode 100644
index ee05a15590..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h
+++ /dev/null
@@ -1,22 +0,0 @@ 
-/* Definition of `struct stat' used in the kernel.
-   Copyright (C) 2003-2021 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
-   <https://www.gnu.org/licenses/>.  */
-
-#define STAT_IS_KERNEL_STAT 1
-#define STAT64_IS_KERNEL_STAT64 1
-#define XSTAT_IS_XSTAT64 1
-#define STATFS_IS_STATFS64 1
diff --git a/sysdeps/unix/sysv/linux/kernel_stat.h b/sysdeps/unix/sysv/linux/kernel_stat.h
index b1bc1459f0..6c1b175cb4 100644
--- a/sysdeps/unix/sysv/linux/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/kernel_stat.h
@@ -1,40 +1,22 @@ 
-/* Definition of `struct stat' used in the kernel..  */
-struct kernel_stat
-  {
-    unsigned short int st_dev;
-    unsigned short int __pad1;
-#define _HAVE___PAD1
-    unsigned long int st_ino;
-    unsigned short int st_mode;
-    unsigned short int st_nlink;
-    unsigned short int st_uid;
-    unsigned short int st_gid;
-    unsigned short int st_rdev;
-    unsigned short int __pad2;
-#define _HAVE___PAD2
-    unsigned long int st_size;
-    unsigned long int st_blksize;
-    unsigned long int st_blocks;
-    struct timespec st_atim;
-    struct timespec st_mtim;
-    struct timespec st_ctim;
-    unsigned long int __glibc_reserved4;
-#define _HAVE___UNUSED4
-    unsigned long int __glibc_reserved5;
-#define _HAVE___UNUSED5
-  };
+/* Internal definitions for stat functions.
+   Copyright (C) 2021 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-#define _HAVE_STAT___UNUSED4
-#define _HAVE_STAT___UNUSED5
-#define _HAVE_STAT___PAD1
-#define _HAVE_STAT___PAD2
-#define _HAVE_STAT_NSEC
-#define _HAVE_STAT64___PAD1
-#define _HAVE_STAT64___PAD2
-#define _HAVE_STAT64___ST_INO
-#define _HAVE_STAT64_NSEC
+   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.
 
-#define STAT_IS_KERNEL_STAT 0
-#define STAT64_IS_KERNEL_STAT64 1
-#define XSTAT_IS_XSTAT64 0
-#define STATFS_IS_STATFS64 0
+   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
+   <https://www.gnu.org/licenses/>.  */
+
+/* The default Linux ABI assumes only LFS support.  */
+#define XSTAT_IS_XSTAT64     1
+#define STATFS_IS_STATFS64   __STATFS_MATCHES_STATFS64
+#define STAT_IS_KERNEL_STAT  1
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel_stat.h b/sysdeps/unix/sysv/linux/m68k/kernel_stat.h
new file mode 100644
index 0000000000..b1bc1459f0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/kernel_stat.h
@@ -0,0 +1,40 @@ 
+/* Definition of `struct stat' used in the kernel..  */
+struct kernel_stat
+  {
+    unsigned short int st_dev;
+    unsigned short int __pad1;
+#define _HAVE___PAD1
+    unsigned long int st_ino;
+    unsigned short int st_mode;
+    unsigned short int st_nlink;
+    unsigned short int st_uid;
+    unsigned short int st_gid;
+    unsigned short int st_rdev;
+    unsigned short int __pad2;
+#define _HAVE___PAD2
+    unsigned long int st_size;
+    unsigned long int st_blksize;
+    unsigned long int st_blocks;
+    struct timespec st_atim;
+    struct timespec st_mtim;
+    struct timespec st_ctim;
+    unsigned long int __glibc_reserved4;
+#define _HAVE___UNUSED4
+    unsigned long int __glibc_reserved5;
+#define _HAVE___UNUSED5
+  };
+
+#define _HAVE_STAT___UNUSED4
+#define _HAVE_STAT___UNUSED5
+#define _HAVE_STAT___PAD1
+#define _HAVE_STAT___PAD2
+#define _HAVE_STAT_NSEC
+#define _HAVE_STAT64___PAD1
+#define _HAVE_STAT64___PAD2
+#define _HAVE_STAT64___ST_INO
+#define _HAVE_STAT64_NSEC
+
+#define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 1
+#define XSTAT_IS_XSTAT64 0
+#define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel_stat.h b/sysdeps/unix/sysv/linux/nios2/kernel_stat.h
similarity index 78%
rename from sysdeps/unix/sysv/linux/aarch64/kernel_stat.h
rename to sysdeps/unix/sysv/linux/nios2/kernel_stat.h
index 33ad1b622b..1af30dab6f 100644
--- a/sysdeps/unix/sysv/linux/aarch64/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/nios2/kernel_stat.h
@@ -1,6 +1,7 @@ 
-/* Internal definitions for stat functions.  Linux/AARch64 version.
+/* Internal definitions for stat functions.  Linux/nios2.
    Copyright (C) 2021 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -16,6 +17,6 @@ 
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-#define STAT_IS_KERNEL_STAT 1
-#define XSTAT_IS_XSTAT64 1
-#define STATFS_IS_STATFS64 1
+#define STAT_IS_KERNEL_STAT  1
+#define XSTAT_IS_XSTAT64     0
+#define STATFS_IS_STATFS64   0
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h
deleted file mode 100644
index bc7390c9ff..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h
+++ /dev/null
@@ -1,22 +0,0 @@ 
-/* Definition of `struct stat' used in the kernel.
-   Copyright (C) 2002-2021 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
-   <https://www.gnu.org/licenses/>.  */
-
-#define STAT_IS_KERNEL_STAT 1
-#define STAT64_IS_KERNEL_STAT64 1
-#define XSTAT_IS_XSTAT64 1
-#define STATFS_IS_STATFS64 1
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h b/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h
new file mode 100644
index 0000000000..b1bc1459f0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h
@@ -0,0 +1,40 @@ 
+/* Definition of `struct stat' used in the kernel..  */
+struct kernel_stat
+  {
+    unsigned short int st_dev;
+    unsigned short int __pad1;
+#define _HAVE___PAD1
+    unsigned long int st_ino;
+    unsigned short int st_mode;
+    unsigned short int st_nlink;
+    unsigned short int st_uid;
+    unsigned short int st_gid;
+    unsigned short int st_rdev;
+    unsigned short int __pad2;
+#define _HAVE___PAD2
+    unsigned long int st_size;
+    unsigned long int st_blksize;
+    unsigned long int st_blocks;
+    struct timespec st_atim;
+    struct timespec st_mtim;
+    struct timespec st_ctim;
+    unsigned long int __glibc_reserved4;
+#define _HAVE___UNUSED4
+    unsigned long int __glibc_reserved5;
+#define _HAVE___UNUSED5
+  };
+
+#define _HAVE_STAT___UNUSED4
+#define _HAVE_STAT___UNUSED5
+#define _HAVE_STAT___PAD1
+#define _HAVE_STAT___PAD2
+#define _HAVE_STAT_NSEC
+#define _HAVE_STAT64___PAD1
+#define _HAVE_STAT64___PAD2
+#define _HAVE_STAT64___ST_INO
+#define _HAVE_STAT64_NSEC
+
+#define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 1
+#define XSTAT_IS_XSTAT64 0
+#define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h
deleted file mode 100644
index ee05a15590..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h
+++ /dev/null
@@ -1,22 +0,0 @@ 
-/* Definition of `struct stat' used in the kernel.
-   Copyright (C) 2003-2021 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
-   <https://www.gnu.org/licenses/>.  */
-
-#define STAT_IS_KERNEL_STAT 1
-#define STAT64_IS_KERNEL_STAT64 1
-#define XSTAT_IS_XSTAT64 1
-#define STATFS_IS_STATFS64 1
diff --git a/sysdeps/unix/sysv/linux/sh/kernel_stat.h b/sysdeps/unix/sysv/linux/sh/kernel_stat.h
new file mode 100644
index 0000000000..b1bc1459f0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/kernel_stat.h
@@ -0,0 +1,40 @@ 
+/* Definition of `struct stat' used in the kernel..  */
+struct kernel_stat
+  {
+    unsigned short int st_dev;
+    unsigned short int __pad1;
+#define _HAVE___PAD1
+    unsigned long int st_ino;
+    unsigned short int st_mode;
+    unsigned short int st_nlink;
+    unsigned short int st_uid;
+    unsigned short int st_gid;
+    unsigned short int st_rdev;
+    unsigned short int __pad2;
+#define _HAVE___PAD2
+    unsigned long int st_size;
+    unsigned long int st_blksize;
+    unsigned long int st_blocks;
+    struct timespec st_atim;
+    struct timespec st_mtim;
+    struct timespec st_ctim;
+    unsigned long int __glibc_reserved4;
+#define _HAVE___UNUSED4
+    unsigned long int __glibc_reserved5;
+#define _HAVE___UNUSED5
+  };
+
+#define _HAVE_STAT___UNUSED4
+#define _HAVE_STAT___UNUSED5
+#define _HAVE_STAT___PAD1
+#define _HAVE_STAT___PAD2
+#define _HAVE_STAT_NSEC
+#define _HAVE_STAT64___PAD1
+#define _HAVE_STAT64___PAD2
+#define _HAVE_STAT64___ST_INO
+#define _HAVE_STAT64_NSEC
+
+#define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 1
+#define XSTAT_IS_XSTAT64 0
+#define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h b/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h
deleted file mode 100644
index ee05a15590..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h
+++ /dev/null
@@ -1,22 +0,0 @@ 
-/* Definition of `struct stat' used in the kernel.
-   Copyright (C) 2003-2021 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
-   <https://www.gnu.org/licenses/>.  */
-
-#define STAT_IS_KERNEL_STAT 1
-#define STAT64_IS_KERNEL_STAT64 1
-#define XSTAT_IS_XSTAT64 1
-#define STATFS_IS_STATFS64 1
diff --git a/sysdeps/unix/sysv/linux/xstatconv.c b/sysdeps/unix/sysv/linux/xstatconv.c
index 5dfe7c5fb5..4d049d4555 100644
--- a/sysdeps/unix/sysv/linux/xstatconv.c
+++ b/sysdeps/unix/sysv/linux/xstatconv.c
@@ -21,12 +21,7 @@ 
 #include <kernel_stat.h>
 #include <sysdep.h>
 
-#if STAT_IS_KERNEL_STAT
-
-/* Dummy.  */
-struct kernel_stat;
-
-#else
+#if !STAT_IS_KERNEL_STAT
 
 #include <string.h>