@@ -2,9 +2,147 @@
#include <io/fts.h>
#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 <sys/stat.h>
+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;
@@ -84,6 +84,9 @@ routines := \
fts \
fts64 \
fts64-time64 \
+ fts-v1 \
+ fts64-v1 \
+ fts64-time64-v1 \
ftw \
ftw64 \
ftw64-time64 \
@@ -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;
@@ -67,23 +67,6 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
#include <string.h>
#include <unistd.h>
-/* 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"
new file mode 100644
@@ -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
+ <https://www.gnu.org/licenses/>. */
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_45)
+# include <sys/types.h>
+
+# 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
@@ -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
@@ -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 */
new file mode 100644
@@ -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
+ <https://www.gnu.org/licenses/>. */
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_34, GLIBC_2_45)
+# include <time.h>
+
+# 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
@@ -19,11 +19,11 @@
#include <time.h>
#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
new file mode 100644
@@ -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
+ <https://www.gnu.org/licenses/>. */
+
+#include <shlib-compat.h>
+
+#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
@@ -16,11 +16,11 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#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
@@ -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;