authorgravatar for hugo.beauzee@datadoghq.comHugo Beauzée-Luyssen <hugo.beauzee@datadoghq.com> 2025-02-13 12:10:35+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-02-14 02:11:26+01:00
log462d26171ba1c7f5174aa08f5c2054a0a8035bac
tree6b22537f8a1095d408d46f89a65e34384cd3d734
parentcb5547e3dece175aa372dbfa26e6e9663cdf1c17

glibc: don't redirect fts to fts64 before glibc 2.23


1 files changed, 24 insertions(+), 1 deletions(-)

  • folderlib
    • folderlibc
      • folderinclude
lib/libc/include/generic-glibc/fts.h+24-1
...@@ -147,6 +147,8 @@ typedef struct _ftsent {...@@ -147,6 +147,8 @@ typedef struct _ftsent {
147} FTSENT;147} FTSENT;
148148
149#ifdef __USE_LARGEFILE64149#ifdef __USE_LARGEFILE64
150// zig patch: 64bits variants appeared starting from glibc 2.23
151# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 23) || __GLIBC__ > 2
150typedef struct _ftsent64 {152typedef struct _ftsent64 {
151 struct _ftsent64 *fts_cycle; /* cycle node */153 struct _ftsent64 *fts_cycle; /* cycle node */
152 struct _ftsent64 *fts_parent; /* parent directory */154 struct _ftsent64 *fts_parent; /* parent directory */
...@@ -175,9 +177,15 @@ typedef struct _ftsent64 {...@@ -175,9 +177,15 @@ typedef struct _ftsent64 {
175 struct stat64 *fts_statp; /* stat(2) information */177 struct stat64 *fts_statp; /* stat(2) information */
176 char fts_name[1]; /* file name */178 char fts_name[1]; /* file name */
177} FTSENT64;179} FTSENT64;
180# endif
178#endif181#endif
179182
180__BEGIN_DECLS183__BEGIN_DECLS
184
185// zig patch: 64bits variants appeared starting from glibc 2.23
186// before that version, we can't declare nor redirect to them
187#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 23) || __GLIBC__ > 2
188
181#ifndef __USE_FILE_OFFSET64189#ifndef __USE_FILE_OFFSET64
182FTSENT *fts_children (FTS *, int);190FTSENT *fts_children (FTS *, int);
183int fts_close (FTS *);191int fts_close (FTS *);
...@@ -216,6 +224,19 @@ int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int),...@@ -216,6 +224,19 @@ int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int),
216# endif224# endif
217# endif225# endif
218#endif226#endif
227#else /* (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 23) || __GLIBC__ > 2 */
228FTSENT *fts_children (FTS *, int);
229int fts_close (FTS *);
230FTS *fts_open (char * const *, int,
231 int (*)(const FTSENT **, const FTSENT **));
232FTSENT *fts_read (FTS *);
233int fts_set (FTS *, FTSENT *, int) __THROW;
234#endif
235
236// zig patch: 64bits time variants appeared starting from glibc 2.34
237// before that version, there is nothing to declare
238#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || __GLIBC__ > 2
239
219#ifdef __USE_LARGEFILE64240#ifdef __USE_LARGEFILE64
220# ifndef __USE_TIME64_REDIRECTS241# ifndef __USE_TIME64_REDIRECTS
221FTSENT64 *fts64_children (FTS64 *, int);242FTSENT64 *fts64_children (FTS64 *, int);
...@@ -243,6 +264,8 @@ int __REDIRECT_NTH (fts64_set, (FTS64 *, FTSENT64 *, int),...@@ -243,6 +264,8 @@ int __REDIRECT_NTH (fts64_set, (FTS64 *, FTSENT64 *, int),
243# endif264# endif
244# endif265# endif
245#endif266#endif
267
268#endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || __GLIBC__ > 2 */
246__END_DECLS269__END_DECLS
247270
248#endif /* fts.h */
\ No newline at end of file
271#endif /* fts.h */