From patchwork Sat Oct 17 16:57:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?0L3QsNCx?= X-Patchwork-Id: 146218 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6FF8B4BA23C4 for ; Sat, 17 Oct 2026 16:58:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6FF8B4BA23C4 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=nabijaczleweli.xyz header.i=@nabijaczleweli.xyz header.a=rsa-sha256 header.s=202605 header.b=AMvtxeH6 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by sourceware.org (Postfix) with ESMTPS id 57DE34BA2E3C for ; Sat, 17 Oct 2026 16:57:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 57DE34BA2E3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=nabijaczleweli.xyz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nabijaczleweli.xyz ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 57DE34BA2E3C Authentication-Results: sourceware.org; arc=none smtp.remote-ip=139.28.40.42 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792256263; cv=none; b=xPiygWJFFCJdQP+gPHQZVrPLGlE4qSXN8dJWb5Zpx/fW+m/QL0SOYGSlFD/TI0qFc2zW/qcHh9PKG3ZpbftylEa43c9kZSnxA5bTAUDQ9z4TX/IzM+08NZ3T6evIsd7TpxGpcZXgggNXPajPWZvhLu48oenYdZ9cFHt+O20BGxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792256263; c=relaxed/simple; bh=2ixb8SG9mXIE9BNsTd1ytNRKN/pcJxLbyfVCzTA+eR0=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=qbYyjZngqBQnFt71hzN4/aoQZmFagMoMCNhdbZFXoaz/Fju4cegZ3ap+t6Ha8X+TRO0hpLlciFgXHMpyI4kqKl3PgKICnaE/DDLR4L1bikggTWVYGi1gX9758JjTglfz3c47k/EL8C8e90GL4zyqg3ut9Bynq7CWZCH2DO2oUPY= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, secure) header.d=nabijaczleweli.xyz header.i=@nabijaczleweli.xyz header.a=rsa-sha256 header.s=202605 header.b=AMvtxeH6 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 57DE34BA2E3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202605; t=1792256261; bh=2ixb8SG9mXIE9BNsTd1ytNRKN/pcJxLbyfVCzTA+eR0=; h=Date:From:To:Subject:From; b=AMvtxeH6Aj6lno5t8eYW3MYWEdqgU2AbQG/lJbaSOcCyB6SC0VJ02F3kDN2ljIlvf 0+Esl1yTTDGZAv4eGk9tlqhR5C4oYAmGY6E5yDak6qelQm10tb3HS9n7lDkdvy2Qwq hhPjOA1M7YBjDNLq8+LjdYIgztFxL/VhomithFlWzV8d5zl0vJd2RTkfearoklMsah aL298vBfLq/B3jK8u2u/Uya26ZfK5f0RgQ9X/w11V+08I41NRgO/ekLXSY/YVOeqgl ljxvXk4OJ29sMliS3VnTshEFp4ac4LQQnbbSfIv/cPTiSXfYqcxPLQK/xi3nezcvfT smCAzHXEPIFQw== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 22D4C7F04 for ; Sat, 17 Oct 2026 18:57:41 +0200 (CEST) Date: Sat, 17 Oct 2026 18:57:40 +0200 From: =?utf-8?b?0L3QsNCx?= To: libc-alpha@sourceware.org Subject: [PATCH] fts: new version with size_t fts_pathlen, fts_namelen & long fts_level Message-ID: <4d3ll6kdfd2ivrtwf2vurnbhpf7drqelem24dmg5524ejqbqbc@tarta.nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20231221-2-4202cf-dirty X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, FROM_SUSPICIOUS_NTLD_FP, GIT_PATCH_0, KAM_INFOUSMEBIZ, KAM_SHORT, KAM_SOMETLD_ARE_BAD_TLD, SPF_HELO_PASS, SPF_PASS, TXREP, T_PDS_OTHER_BAD_TLD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org The current API uses unsigned short and short for these fields, and neither of them is adequate, especially fts_pathlen (BZ 22944, Debian 1150233, [1]). Other implementations have already upgraded: fts_{path,name}len fts_level 4.4BSD-Lite2 unsigned short short OpenBSD 7.9 size_t int FreeBSD 15.1 size_t long NetBSD 11.0 short short musl-fts unsigned int int glibc 2.44 unsigned short short (this patch) size_t long This fixes the io/tst-fts-bz22944-verylong test from [1] from FAIL/UNSUPPORTED to PASS. Tested on i386-linux-gnu and x86_64-linux-gnu. [1]: https://sourceware.org/pipermail/libc-alpha/2026-October/181310.html Signed-off-by: Ahelenia ZiemiaƄska --- $ nm -D /lib/x86_64-linux-gnu/libc.so.6 libc.so.6 | grep -Fe fts -e libc.so.6 /lib/x86_64-linux-gnu/libc.so.6: 00000000000fc0d0 W fts64_children@@GLIBC_2.23 00000000000fbaa0 W fts64_close@@GLIBC_2.23 00000000000fb790 W fts64_open@@GLIBC_2.23 00000000000fbb90 W fts64_read@@GLIBC_2.23 00000000000fc0a0 W fts64_set@@GLIBC_2.23 00000000000fc0d0 T fts_children@@GLIBC_2.2.5 00000000000fbaa0 T fts_close@@GLIBC_2.2.5 00000000000fb790 T fts_open@@GLIBC_2.2.5 00000000000fbb90 T fts_read@@GLIBC_2.2.5 00000000000fc0a0 T fts_set@@GLIBC_2.2.5 libc.so.6: 0000000000139b77 T fts64_children@GLIBC_2.23 00000000000e2ad2 T fts64_children@@GLIBC_2.45 0000000000139378 T fts64_close@GLIBC_2.23 00000000000e22e6 T fts64_close@@GLIBC_2.45 0000000000138f77 T fts64_open@GLIBC_2.23 00000000000e1edc T fts64_open@@GLIBC_2.45 00000000000e242c T fts64_read@@GLIBC_2.45 00000000001394be T fts64_read@GLIBC_2.23 00000000000e2aaf T fts64_set@@GLIBC_2.45 0000000000139b54 T fts64_set@GLIBC_2.23 00000000000e2ad2 T fts_children@@GLIBC_2.45 0000000000139b77 T fts_children@GLIBC_2.2.5 0000000000139378 T fts_close@GLIBC_2.2.5 00000000000e22e6 T fts_close@@GLIBC_2.45 00000000000e1edc T fts_open@@GLIBC_2.45 0000000000138f77 T fts_open@GLIBC_2.2.5 00000000000e242c T fts_read@@GLIBC_2.45 00000000001394be T fts_read@GLIBC_2.2.5 00000000000e2aaf T fts_set@@GLIBC_2.45 0000000000139b54 T fts_set@GLIBC_2.2.5 # nm -D /lib/i386-linux-gnu/libc.so.6 libc.so.6 | grep -Fe fts -e libc.so.6 /lib/i386-linux-gnu/libc.so.6: 00117500 T __fts64_children_time64@@GLIBC_2.34 00116e50 T __fts64_close_time64@@GLIBC_2.34 00116ac0 T __fts64_open_time64@@GLIBC_2.34 00116f80 T __fts64_read_time64@@GLIBC_2.34 001174c0 T __fts64_set_time64@@GLIBC_2.34 00115ae0 T fts64_children@@GLIBC_2.23 00115430 T fts64_close@@GLIBC_2.23 001150a0 T fts64_open@@GLIBC_2.23 00115560 T fts64_read@@GLIBC_2.23 00115aa0 T fts64_set@@GLIBC_2.23 001140c0 T fts_children@@GLIBC_2.0 00113a10 T fts_close@@GLIBC_2.0 00113680 T fts_open@@GLIBC_2.0 00113b40 T fts_read@@GLIBC_2.0 00114080 T fts_set@@GLIBC_2.0 libc.so.6: 000fc7d6 T __fts64_children_time64@@GLIBC_2.45 0010361c T __fts64_children_time64@GLIBC_2.34 00102dde T __fts64_close_time64@GLIBC_2.34 000fbfb0 T __fts64_close_time64@@GLIBC_2.45 000fbb85 T __fts64_open_time64@@GLIBC_2.45 001029ba T __fts64_open_time64@GLIBC_2.34 00102f50 T __fts64_read_time64@GLIBC_2.34 000fc120 T __fts64_read_time64@@GLIBC_2.45 001035e7 T __fts64_set_time64@GLIBC_2.34 000fc7a1 T __fts64_set_time64@@GLIBC_2.45 0010111c T fts64_children@GLIBC_2.23 000fa376 T fts64_children@@GLIBC_2.45 001008de T fts64_close@GLIBC_2.23 000f9b50 T fts64_close@@GLIBC_2.45 001004ba T fts64_open@GLIBC_2.23 000f9725 T fts64_open@@GLIBC_2.45 000f9cc0 T fts64_read@@GLIBC_2.45 00100a50 T fts64_read@GLIBC_2.23 000fa341 T fts64_set@@GLIBC_2.45 001010e7 T fts64_set@GLIBC_2.23 000f7efd T fts_children@@GLIBC_2.45 000fec33 T fts_children@GLIBC_2.0 000fe3f7 T fts_close@GLIBC_2.0 000f76e9 T fts_close@@GLIBC_2.45 000fdfde T fts_open@GLIBC_2.0 000f72c5 T fts_open@@GLIBC_2.45 000f7859 T fts_read@@GLIBC_2.45 000fe569 T fts_read@GLIBC_2.0 000f7ec8 T fts_set@@GLIBC_2.45 000febfe T fts_set@GLIBC_2.0 include/fts.h | 146 ++++++++++++++++++++++++++++++- io/Makefile | 3 + io/Versions | 4 + io/fts-common.c | 17 ---- io/fts-v1.c | 48 ++++++++++ io/fts.c | 20 +++++ io/fts.h | 16 ++-- io/fts64-time64-v1.c | 47 ++++++++++ io/fts64-time64.c | 16 ++-- io/fts64-v1.c | 69 +++++++++++++++ io/fts64.c | 30 +++---- sysdeps/unix/sysv/linux/Versions | 9 ++ 12 files changed, 376 insertions(+), 49 deletions(-) create mode 100644 io/fts-v1.c create mode 100644 io/fts64-time64-v1.c create mode 100644 io/fts64-v1.c diff --git include/fts.h include/fts.h index 972884647b..9fd364eef4 100644 --- include/fts.h +++ include/fts.h @@ -2,9 +2,147 @@ #include #ifndef _ISOMAC +typedef struct { + struct _ftsent_v1 *fts_cur; + struct _ftsent_v1 *fts_child; + struct _ftsent_v1 **fts_array; + dev_t fts_dev; + char *fts_path; + int fts_rfd; + int fts_pathlen; + int fts_nitems; + int (*fts_compar) (const void *, const void *); + int fts_options; + int fts_cwd_fd; + struct hash_table *fts_leaf_optimization_works_ht; + union { + struct hash_table *ht; + struct cycle_check_state *state; + } fts_cycle; + __I_ring fts_fd_ring; +} __FTS_V1; + +#ifdef __USE_LARGEFILE64 +typedef struct { + struct _ftsent64_v1 *fts_cur; + struct _ftsent64_v1 *fts_child; + struct _ftsent64_v1 **fts_array; + dev_t fts_dev; + char *fts_path; + int fts_rfd; + int fts_pathlen; + int fts_nitems; + int (*fts_compar) (const void *, const void *); + int fts_options; + int fts_cwd_fd; + struct hash_table *fts_leaf_optimization_works_ht; + union { + struct hash_table *ht; + struct cycle_check_state *state; + } fts_cycle; + __I_ring fts_fd_ring; +} __FTS64_V1; +#endif + +typedef struct _ftsent_v1 { + struct _ftsent_v1 *fts_cycle; + struct _ftsent_v1 *fts_parent; + struct _ftsent_v1 *fts_link; + long fts_number; + void *fts_pointer; + char *fts_accpath; + char *fts_path; + int fts_errno; + int fts_symfd; + unsigned short fts_pathlen; + unsigned short fts_namelen; + ino_t fts_ino; + dev_t fts_dev; + nlink_t fts_nlink; + short fts_level; + unsigned short fts_info; + unsigned short fts_flags; + unsigned short fts_instr; + struct stat *fts_statp; + char fts_name[1]; +} __FTSENT_V1; + +#ifdef __USE_LARGEFILE64 +typedef struct _ftsent64_v1 { + struct _ftsent64_v1 *fts_cycle; + struct _ftsent64_v1 *fts_parent; + struct _ftsent64_v1 *fts_link; + long fts_number; + void *fts_pointer; + char *fts_accpath; + char *fts_path; + int fts_errno; + int fts_symfd; + unsigned short fts_pathlen; + unsigned short fts_namelen; + ino64_t fts_ino; + dev_t fts_dev; + nlink_t fts_nlink; + short fts_level; + unsigned short fts_info; + unsigned short fts_flags; + unsigned short fts_instr; + struct stat64 *fts_statp; + char fts_name[1]; +} __FTSENT64_V1; +#endif + # if __TIMESIZE != 64 # include +typedef struct +{ + struct _ftsent64_time64_v1 *fts_cur; + struct _ftsent64_time64_v1 *fts_child; + struct _ftsent64_time64_v1 **fts_array; + dev_t fts_dev; + char *fts_path; + int fts_rfd; + int fts_pathlen; + int fts_nitems; + int (*fts_compar) (const void *, const void *); + int fts_options; + int fts_cwd_fd; + struct hash_table *fts_leaf_optimization_works_ht; + union { + struct hash_table *ht; + struct cycle_check_state *state; + } fts_cycle; + __I_ring fts_fd_ring; +} __FTS64_TIME64_V1; + +typedef struct _ftsent64_time64_v1 +{ + struct _ftsent64_time64_v1 *fts_cycle; + struct _ftsent64_time64_v1 *fts_parent; + struct _ftsent64_time64_v1 *fts_link; + long fts_number; + void *fts_pointer; + char *fts_accpath; + char *fts_path; + int fts_errno; + int fts_symfd; + unsigned short fts_pathlen; + unsigned short fts_namelen; + + ino64_t fts_ino; + dev_t fts_dev; + nlink_t fts_nlink; + + short fts_level; + unsigned short fts_info; + unsigned short fts_flags; + unsigned short fts_instr; + + struct __stat64_t64 *fts_statp; + char fts_name[1]; +} __FSTENT64_TIME64_V1; + typedef struct { struct _ftsent64_time64 *fts_cur; @@ -12,8 +150,8 @@ typedef struct struct _ftsent64_time64 **fts_array; dev_t fts_dev; char *fts_path; + size_t fts_pathlen; int fts_rfd; - int fts_pathlen; int fts_nitems; int (*fts_compar) (const void *, const void *); int fts_options; @@ -37,14 +175,14 @@ typedef struct _ftsent64_time64 char *fts_path; int fts_errno; int fts_symfd; - unsigned short fts_pathlen; - unsigned short fts_namelen; + size_t fts_pathlen; + size_t fts_namelen; ino64_t fts_ino; dev_t fts_dev; nlink_t fts_nlink; - short fts_level; + int fts_level; unsigned short fts_info; unsigned short fts_flags; unsigned short fts_instr; diff --git io/Makefile io/Makefile index 9a83578a83..7018e63ef9 100644 --- io/Makefile +++ io/Makefile @@ -84,6 +84,9 @@ routines := \ fts \ fts64 \ fts64-time64 \ + fts-v1 \ + fts64-v1 \ + fts64-time64-v1 \ ftw \ ftw64 \ ftw64-time64 \ diff --git io/Versions io/Versions index e5f297e39e..bc96687df3 100644 --- io/Versions +++ io/Versions @@ -137,6 +137,10 @@ libc { GLIBC_2.34 { closefrom; } + GLIBC_2.45 { + fts_children; fts_close; fts_open; fts_read; fts_set; + fts64_children; fts64_close; fts64_open; fts64_read; fts64_set; + } GLIBC_PRIVATE { __fcntl_nocancel; __open64_nocancel; diff --git io/fts-common.c io/fts-common.c index 351ba6a022..2562a1be8d 100644 --- io/fts-common.c +++ io/fts-common.c @@ -67,23 +67,6 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #include #include -/* Support for the LFS API version. */ -#ifndef FTS_OPEN -# define FTS_OPEN fts_open -# define FTS_CLOSE fts_close -# define FTS_READ fts_read -# define FTS_SET fts_set -# define FTS_CHILDREN fts_children -# define FTSOBJ FTS -# define FTSENTRY FTSENT -# define INO_T ino_t -# define STRUCT_STAT stat -# define FSTAT __fstat -# define FSTATAT __fstatat -# define STRUCT_STATFS statfs -# define FSTATFS __fstatfs -#endif - #if ! _LIBC # include "attribute.h" # include "fcntl--.h" diff --git io/fts-v1.c io/fts-v1.c new file mode 100644 index 0000000000..b4170111db --- /dev/null +++ io/fts-v1.c @@ -0,0 +1,48 @@ +/* File tree traversal functions LFS 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 + . */ + +#include + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_45) +# include + +# if !defined __OFF_T_MATCHES_OFF64_T \ + || !defined __INO_T_MATCHES_INO64_T +# define FTS_OPEN __fts_open_v1 +# define FTS_CLOSE __fts_close_v1 +# define FTS_READ __fts_read_v1 +# define FTS_SET __fts_set_v1 +# define FTS_CHILDREN __fts_children_v1 +# define FTSOBJ __FTS_V1 +# define FTSENTRY __FTSENT_V1 +# define INO_T ino_t +# define STRUCT_STAT stat +# define FSTAT __fstat +# define FSTATAT __fstatat +# define STRUCT_STATFS statfs +# define FSTATFS __fstatfs + +# include "io/fts-common.c" + +compat_symbol (libc, __fts_open_v1, fts_open, GLIBC_2_0); +compat_symbol (libc, __fts_close_v1, fts_close, GLIBC_2_0); +compat_symbol (libc, __fts_read_v1, fts_read, GLIBC_2_0); +compat_symbol (libc, __fts_set_v1, fts_set, GLIBC_2_0); +compat_symbol (libc, __fts_children_v1, fts_children, GLIBC_2_0); +# endif +#endif diff --git io/fts.c io/fts.c index c7df552b83..e5d6f73dee 100644 --- io/fts.c +++ io/fts.c @@ -20,5 +20,25 @@ #if !defined __OFF_T_MATCHES_OFF64_T \ || !defined __INO_T_MATCHES_INO64_T +# define FTS_OPEN __fts_open_v2 +# define FTS_CLOSE __fts_close_v2 +# define FTS_READ __fts_read_v2 +# define FTS_SET __fts_set_v2 +# define FTS_CHILDREN __fts_children_v2 +# define FTSOBJ FTS +# define FTSENTRY FTSENT +# define INO_T ino_t +# define STRUCT_STAT stat +# define FSTAT __fstat +# define FSTATAT __fstatat +# define STRUCT_STATFS statfs +# define FSTATFS __fstatfs + # include "io/fts-common.c" + +versioned_symbol (libc, __fts_open_v2, fts_open, GLIBC_2_45); +versioned_symbol (libc, __fts_close_v2, fts_close, GLIBC_2_45); +versioned_symbol (libc, __fts_read_v2, fts_read, GLIBC_2_45); +versioned_symbol (libc, __fts_set_v2, fts_set, GLIBC_2_45); +versioned_symbol (libc, __fts_children_v2, fts_children, GLIBC_2_45); #endif diff --git io/fts.h io/fts.h index 50636e6c87..47d6190d05 100644 --- io/fts.h +++ io/fts.h @@ -82,8 +82,8 @@ typedef struct { struct _ftsent **fts_array; /* sort array */ dev_t fts_dev; /* starting device # */ char *fts_path; /* path for this descent */ + size_t fts_pathlen; /* sizeof(path) */ int fts_rfd; /* fd for root */ - int fts_pathlen; /* sizeof(path) */ int fts_nitems; /* elements in the sort array */ int (*fts_compar) (const void *, const void *); /* compare fn */ @@ -204,8 +204,8 @@ typedef struct { struct _ftsent64 **fts_array; /* sort array */ dev_t fts_dev; /* starting device # */ char *fts_path; /* path for this descent */ + size_t fts_pathlen; /* sizeof(path) */ int fts_rfd; /* fd for root */ - int fts_pathlen; /* sizeof(path) */ int fts_nitems; /* elements in the sort array */ int (*fts_compar) (const void *, const void *); /* compare fn */ int fts_options; /* fts_open options, global flags */ @@ -229,8 +229,8 @@ typedef struct _ftsent { char *fts_path; /* root path */ int fts_errno; /* errno for this node */ int fts_symfd; /* fd for symlink */ - unsigned short fts_pathlen; /* strlen(fts_path) */ - unsigned short fts_namelen; /* strlen(fts_name) */ + size_t fts_pathlen; /* strlen(fts_path) */ + size_t fts_namelen; /* strlen(fts_name) */ ino_t fts_ino; /* inode */ dev_t fts_dev; /* device */ @@ -238,7 +238,7 @@ typedef struct _ftsent { #define FTS_ROOTPARENTLEVEL -1 #define FTS_ROOTLEVEL 0 - short fts_level; /* depth (-1 to N) */ + long fts_level; /* depth (-1 to N) */ #define FTS_D 1 /* preorder directory */ #define FTS_DC 2 /* directory that causes cycles */ @@ -281,14 +281,14 @@ typedef struct _ftsent64 { char *fts_path; /* root path */ int fts_errno; /* errno for this node */ int fts_symfd; /* fd for symlink */ - unsigned short fts_pathlen; /* strlen(fts_path) */ - unsigned short fts_namelen; /* strlen(fts_name) */ + size_t fts_pathlen; /* strlen(fts_path) */ + size_t fts_namelen; /* strlen(fts_name) */ ino64_t fts_ino; /* inode */ dev_t fts_dev; /* device */ nlink_t fts_nlink; /* link count */ - short fts_level; /* depth (-1 to N) */ + long fts_level; /* depth (-1 to N) */ unsigned short fts_info; /* user flags for FTSENT structure */ diff --git io/fts64-time64-v1.c io/fts64-time64-v1.c new file mode 100644 index 0000000000..fd68dc4430 --- /dev/null +++ io/fts64-time64-v1.c @@ -0,0 +1,47 @@ +/* File tree traversal functions LFS version. + Copyright (C) 2015-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 + . */ + +#include + +#if SHLIB_COMPAT (libc, GLIBC_2_34, GLIBC_2_45) +# include + +# if __TIMESIZE != 64 +# define FTS_OPEN __fts64_open_time64_v1 +# define FTS_CLOSE __fts64_close_time64_v1 +# define FTS_READ __fts64_read_time64_v1 +# define FTS_SET __fts64_set_time64_v1 +# define FTS_CHILDREN __fts64_children_time64_v1 +# define FTSOBJ __FTS64_TIME64_V1 +# define FTSENTRY __FSTENT64_TIME64_V1 +# define INO_T ino64_t +# define STRUCT_STAT __stat64_t64 +# define FSTAT __fstat64_time64 +# define FSTATAT __fstatat64_time64 +# define STRUCT_STATFS statfs64 +# define FSTATFS __fstatfs64 + +# include "fts-common.c" + +compat_symbol (libc, __fts64_open_time64_v1, __fts64_open_time64, GLIBC_2_34); +compat_symbol (libc, __fts64_close_time64_v1, __fts64_close_time64, GLIBC_2_34); +compat_symbol (libc, __fts64_read_time64_v1, __fts64_read_time64, GLIBC_2_34); +compat_symbol (libc, __fts64_set_time64_v1, __fts64_set_time64, GLIBC_2_34); +compat_symbol (libc, __fts64_children_time64_v1, __fts64_children_time64, GLIBC_2_34); +# endif +#endif diff --git io/fts64-time64.c io/fts64-time64.c index 29f2dbc28c..12244d73b9 100644 --- io/fts64-time64.c +++ io/fts64-time64.c @@ -19,11 +19,11 @@ #include #if __TIMESIZE != 64 -# define FTS_OPEN __fts64_open_time64 -# define FTS_CLOSE __fts64_close_time64 -# define FTS_READ __fts64_read_time64 -# define FTS_SET __fts64_set_time64 -# define FTS_CHILDREN __fts64_children_time64 +# define FTS_OPEN __fts64_open_time64_v2 +# define FTS_CLOSE __fts64_close_time64_v2 +# define FTS_READ __fts64_read_time64_v2 +# define FTS_SET __fts64_set_time64_v2 +# define FTS_CHILDREN __fts64_children_time64_v2 # define FTSOBJ FTS64_TIME64 # define FTSENTRY FSTENT64_TIME64 # define INO_T ino64_t @@ -34,4 +34,10 @@ # define FSTATFS __fstatfs64 # include "fts-common.c" + +versioned_symbol (libc, __fts64_open_time64_v2, __fts64_open_time64, GLIBC_2_45); +versioned_symbol (libc, __fts64_close_time64_v2, __fts64_close_time64, GLIBC_2_45); +versioned_symbol (libc, __fts64_read_time64_v2, __fts64_read_time64, GLIBC_2_45); +versioned_symbol (libc, __fts64_set_time64_v2, __fts64_set_time64, GLIBC_2_45); +versioned_symbol (libc, __fts64_children_time64_v2, __fts64_children_time64, GLIBC_2_45); #endif diff --git io/fts64-v1.c io/fts64-v1.c new file mode 100644 index 0000000000..5f362bb920 --- /dev/null +++ io/fts64-v1.c @@ -0,0 +1,69 @@ +/* File tree traversal functions LFS version. + Copyright (C) 2015-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 + . */ + +#include + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_45) \ + || SHLIB_COMPAT (libc, GLIBC_2_23, GLIBC_2_45) +# define FTS_OPEN __fts64_open_v1 +# define FTS_CLOSE __fts64_close_v1 +# define FTS_READ __fts64_read_v1 +# define FTS_SET __fts64_set_v1 +# define FTS_CHILDREN __fts64_children_v1 +# define FTSOBJ __FTS64_V1 +# define FTSENTRY __FTSENT64_V1 +# define INO_T ino64_t +# define STRUCT_STAT stat64 +# define FSTAT __fstat64 +# define FSTATAT __fstatat64 +# define STRUCT_STATFS statfs64 +# define FSTATFS __fstatfs64 + +#define fts_open __rename_fts_open +#define fts_close __rename_fts_close +#define fts_read __rename_fts_read +#define fts_set __rename_fts_set +#define fts_children __rename_fts_children + +# include "fts-common.c" + +#undef fts_open +#undef fts_close +#undef fts_read +#undef fts_set +#undef fts_children + +# if SHLIB_COMPAT (libc, GLIBC_2_33, GLIBC_2_45) +compat_symbol (libc, __fts64_open_v1, fts64_open, GLIBC_2_23); +compat_symbol (libc, __fts64_close_v1, fts64_close, GLIBC_2_23); +compat_symbol (libc, __fts64_read_v1, fts64_read, GLIBC_2_23); +compat_symbol (libc, __fts64_set_v1, fts64_set, GLIBC_2_23); +compat_symbol (libc, __fts64_children_v1, fts64_children, GLIBC_2_23); +# endif + +# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_45) +# if defined __OFF_T_MATCHES_OFF64_T \ + && defined __INO_T_MATCHES_INO64_T +compat_symbol (libc, __fts64_open_v1, fts_open, GLIBC_2_0); +compat_symbol (libc, __fts64_close_v1, fts_close, GLIBC_2_0); +compat_symbol (libc, __fts64_read_v1, fts_read, GLIBC_2_0); +compat_symbol (libc, __fts64_set_v1, fts_set, GLIBC_2_0); +compat_symbol (libc, __fts64_children_v1, fts_children, GLIBC_2_0); +# endif +# endif +#endif diff --git io/fts64.c io/fts64.c index c2cf45523e..a72133178a 100644 --- io/fts64.c +++ io/fts64.c @@ -16,11 +16,11 @@ License along with the GNU C Library; if not, see . */ -#define FTS_OPEN __fts64_open -#define FTS_CLOSE __fts64_close -#define FTS_READ __fts64_read -#define FTS_SET __fts64_set -#define FTS_CHILDREN __fts64_children +#define FTS_OPEN __fts64_open_v2 +#define FTS_CLOSE __fts64_close_v2 +#define FTS_READ __fts64_read_v2 +#define FTS_SET __fts64_set_v2 +#define FTS_CHILDREN __fts64_children_v2 #define FTSOBJ FTS64 #define FTSENTRY FTSENT64 #define INO_T ino64_t @@ -44,17 +44,17 @@ #undef fts_set #undef fts_children -weak_alias (__fts64_open, fts64_open) -weak_alias (__fts64_close, fts64_close) -weak_alias (__fts64_read, fts64_read) -weak_alias (__fts64_set, fts64_set) -weak_alias (__fts64_children, fts64_children) +versioned_symbol (libc, __fts64_open_v2, fts64_open, GLIBC_2_45); +versioned_symbol (libc, __fts64_close_v2, fts64_close, GLIBC_2_45); +versioned_symbol (libc, __fts64_read_v2, fts64_read, GLIBC_2_45); +versioned_symbol (libc, __fts64_set_v2, fts64_set, GLIBC_2_45); +versioned_symbol (libc, __fts64_children_v2, fts64_children, GLIBC_2_45); #if defined __OFF_T_MATCHES_OFF64_T \ && defined __INO_T_MATCHES_INO64_T -weak_alias (__fts64_open, fts_open) -weak_alias (__fts64_close, fts_close) -weak_alias (__fts64_read, fts_read) -weak_alias (__fts64_set, fts_set) -weak_alias (__fts64_children, fts_children) +versioned_symbol (libc, __fts64_open_v2, fts_open, GLIBC_2_45); +versioned_symbol (libc, __fts64_close_v2, fts_close, GLIBC_2_45); +versioned_symbol (libc, __fts64_read_v2, fts_read, GLIBC_2_45); +versioned_symbol (libc, __fts64_set_v2, fts_set, GLIBC_2_45); +versioned_symbol (libc, __fts64_children_v2, fts_children, GLIBC_2_45); #endif diff --git sysdeps/unix/sysv/linux/Versions sysdeps/unix/sysv/linux/Versions index c7f199f13f..6e4f4e1706 100644 --- sysdeps/unix/sysv/linux/Versions +++ sysdeps/unix/sysv/linux/Versions @@ -343,6 +343,15 @@ libc { mseal; openat2; } + GLIBC_2.45 { +%ifdef TIME64_NON_DEFAULT + __fts64_open_time64; + __fts64_close_time64; + __fts64_read_time64; + __fts64_set_time64; + __fts64_children_time64; +%endif + } GLIBC_PRIVATE { # functions used in other libraries __syscall_rt_sigqueueinfo;