[COMMITTED] hurd: Fix build after the ftw kernel_stat.h inclusion
Adhemerval Zanella <[email protected]> Tue, 4 Aug 2026 13:48:19 -0300
| Newsgroups | gmane.comp.lib.glibc.alpha |
|---|---|
| Message-ID | <[email protected]> |
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 | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
create mode 100644 sysdeps/mach/hurd/kernel_stat.h
diff --git a/sysdeps/mach/hurd/kernel_stat.h b/sysdeps/mach/hurd/kernel_stat.h
new file mode 100644
index 00000000000..aa8c26b1d96
--- /dev/null
+++ b/sysdeps/mach/hurd/kernel_stat.h
@@ -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
--
2.53.0