[glibc] hurd: Fix build after the ftw kernel_stat.h inclusion

Adhemerval Zanella via Glibc-cvs <[email protected]> Tue, 4 Aug 2026 16:47:57 +0000 (GMT)
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d6031665c3a59faf75cf6bc55e041611da21d0e6

commit d6031665c3a59faf75cf6bc55e041611da21d0e6
Author: Adhemerval Zanella <[email protected]>
Date:   Tue Aug 4 14:25:48 2026 +0000

    hurd: Fix build after the ftw kernel_stat.h inclusion
    
    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.

Diff:
---
 sysdeps/mach/hurd/kernel_stat.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/sysdeps/mach/hurd/kernel_stat.h b/sysdeps/mach/hurd/kernel_stat.h
new file mode 100644
index 0000000000..aa8c26b1d9
--- /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