]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Fix build after the ftw kernel_stat.h inclusion master
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 4 Aug 2026 14:25:48 +0000 (14:25 +0000)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 4 Aug 2026 16:45:18 +0000 (13:45 -0300)
Commit 6758def7171 changed the generic ftw{64}.c to include
kernel_stat.h, which is Linux specific.

Add a Hurd version of kernel_stat.h defining XSTAT_IS_XSTAT64 to 0,
since struct stat and struct stat64 never share a layout on Hurd: on
32-bit ABIs st_ino, st_size, and st_blocks are narrower in struct stat,
and on 64-bit ABIs the two structures still differ in size because
_SPARE_SIZE in bits/stat.h reserves three more ints of spare space in
struct stat than in struct stat64.

This keeps the ftw/ftw64 symbols exactly as before the change, where
the aliasing check on __OFF_T_MATCHES_OFF64_T was always false because
the Hurd bits/typesizes.h does not define it.

Checked with a full build for i686-gnu and x86_64-gnu.

sysdeps/mach/hurd/kernel_stat.h [new file with mode: 0644]

diff --git a/sysdeps/mach/hurd/kernel_stat.h b/sysdeps/mach/hurd/kernel_stat.h
new file mode 100644 (file)
index 0000000..aa8c26b
--- /dev/null
@@ -0,0 +1,23 @@
+/* Internal definitions for stat functions.  Hurd version.
+   Copyright (C) 2026 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/>.  */
+
+/* struct stat and struct stat64 never have the same layout: on 32-bit
+   ABIs st_ino, st_size, and st_blocks are narrower in struct stat, and
+   on 64-bit ABIs the two structures still differ in the amount of
+   trailing spare space (see _SPARE_SIZE in bits/stat.h).  */
+#define XSTAT_IS_XSTAT64 0