mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-08 06:10:06 +00:00
io: Add fts64 with 64-bit time_t support
Similar to glob, fts routines passes a stat pointer that might differ of size and layout when 64-bit time API is used. Checked on i686-linux-gnu and x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
parent
84f7ce8447
commit
70961aee18
@ -1 +1,52 @@
|
||||
#ifndef _FTS_H
|
||||
#include <io/fts.h>
|
||||
|
||||
#ifndef _ISOMAC
|
||||
# if __TIMESIZE != 64
|
||||
# include <sys/stat.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct _ftsent64_time64 *fts_cur;
|
||||
struct _ftsent64_time64 *fts_child;
|
||||
struct _ftsent64_time64 **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;
|
||||
} FTS64_TIME64;
|
||||
|
||||
typedef struct _ftsent64_time64
|
||||
{
|
||||
struct _ftsent64_time64 *fts_cycle;
|
||||
struct _ftsent64_time64 *fts_parent;
|
||||
struct _ftsent64_time64 *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;
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* _FTS_H */
|
||||
|
@ -54,7 +54,8 @@ routines := \
|
||||
posix_fadvise posix_fadvise64 \
|
||||
posix_fallocate posix_fallocate64 \
|
||||
sendfile sendfile64 copy_file_range \
|
||||
utimensat futimens file_change_detection
|
||||
utimensat futimens file_change_detection \
|
||||
fts64-time64
|
||||
|
||||
others := pwd
|
||||
test-srcs := ftwtest
|
||||
@ -102,6 +103,7 @@ CFLAGS-statvfs.c += -fexceptions
|
||||
CFLAGS-fstatvfs.c += -fexceptions
|
||||
CFLAGS-fts.c += -Wno-uninitialized $(uses-callbacks) -fexceptions
|
||||
CFLAGS-fts64.c += -Wno-uninitialized $(uses-callbacks) -fexceptions
|
||||
CFLAGS-fts64-time64.c += -Wno-uninitialized $(uses-callbacks) -fexceptions
|
||||
CFLAGS-ftw.c += $(uses-callbacks) -fexceptions
|
||||
CFLAGS-ftw64.c += $(uses-callbacks) -fexceptions
|
||||
CFLAGS-posix_fallocate.c += -fexceptions
|
||||
|
43
io/fts.h
43
io/fts.h
@ -187,6 +187,7 @@ FTSENT *fts_read (FTS *);
|
||||
int fts_set (FTS *, FTSENT *, int) __THROW;
|
||||
#else
|
||||
# ifdef __REDIRECT
|
||||
# ifndef __USE_TIME_BITS64
|
||||
FTSENT *__REDIRECT (fts_children, (FTS *, int), fts64_children);
|
||||
int __REDIRECT (fts_close, (FTS *), fts64_close);
|
||||
FTS *__REDIRECT (fts_open, (char * const *, int,
|
||||
@ -194,21 +195,53 @@ FTS *__REDIRECT (fts_open, (char * const *, int,
|
||||
fts64_open);
|
||||
FTSENT *__REDIRECT (fts_read, (FTS *), fts64_read);
|
||||
int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), fts64_set);
|
||||
# else
|
||||
FTSENT *__REDIRECT (fts_children, (FTS *, int), __fts64_children_time64);
|
||||
int __REDIRECT (fts_close, (FTS *), __fts64_close_time64);
|
||||
FTS *__REDIRECT (fts_open, (char * const *, int,
|
||||
int (*)(const FTSENT **, const FTSENT **)),
|
||||
__fts64_open_time64);
|
||||
FTSENT *__REDIRECT (fts_read, (FTS *), __fts64_read_time64);
|
||||
int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int),
|
||||
__fts64_set_time64);
|
||||
# endif
|
||||
# else
|
||||
# define fts_children fts64_children
|
||||
# define fts_close fts64_close
|
||||
# define fts_open fts64_open
|
||||
# define fts_read fts64_read
|
||||
# define fts_set fts64_set
|
||||
# ifndef __USE_TIME_BITS64
|
||||
# define fts_children fts64_children
|
||||
# define fts_close fts64_close
|
||||
# define fts_open fts64_open
|
||||
# define fts_read fts64_read
|
||||
# define fts_set fts64_set
|
||||
# else
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#ifdef __USE_LARGEFILE64
|
||||
# ifndef __USE_TIME_BITS64
|
||||
FTSENT64 *fts64_children (FTS64 *, int);
|
||||
int fts64_close (FTS64 *);
|
||||
FTS64 *fts64_open (char * const *, int,
|
||||
int (*)(const FTSENT64 **, const FTSENT64 **));
|
||||
FTSENT64 *fts64_read (FTS64 *);
|
||||
int fts64_set (FTS64 *, FTSENT64 *, int) __THROW;
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
FTSENT *__REDIRECT (fts64_children, (FTS64 *, int), __fts64_children_time64);
|
||||
int __REDIRECT (fts64_close, (FTS64 *), __fts64_close_time64);
|
||||
FTS *__REDIRECT (fts64_open, (char * const *, int,
|
||||
int (*)(const FTSENT64 **, const FTSENT64 **)),
|
||||
__fts64_open_time64);
|
||||
FTSENT *__REDIRECT (fts64_read, (FTS64 *), __fts64_read_time64);
|
||||
int __REDIRECT_NTH (fts64_set, (FTS64 *, FTSENT64 *, int),
|
||||
__fts64_set_time64);
|
||||
# else
|
||||
# define fts_children __fts64_children_time64
|
||||
# define fts_close __fts64_close_time64
|
||||
# define fts_open __fts64_open_time64
|
||||
# define fts_read __fts64_read_time64
|
||||
# define fts_set __fts64_set_time64
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
|
35
io/fts64-time64.c
Normal file
35
io/fts64-time64.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* File tree traversal functions LFS version.
|
||||
Copyright (C) 2015-2021 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 <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 FTSOBJ FTS64_TIME64
|
||||
# define FTSENTRY FSTENT64_TIME64
|
||||
# define INO_T ino64_t
|
||||
# define STRUCT_STAT __stat64_t64
|
||||
# define STAT __stat64_time64
|
||||
# define LSTAT __lstat64_time64
|
||||
|
||||
# include "fts.c"
|
||||
#endif
|
@ -206,6 +206,11 @@ libc {
|
||||
__futimens64;
|
||||
__futimes64;
|
||||
__futimesat64;
|
||||
__fts64_open_time64;
|
||||
__fts64_close_time64;
|
||||
__fts64_read_time64;
|
||||
__fts64_set_time64;
|
||||
__fts64_children_time64;
|
||||
__getitimer64;
|
||||
__getrusage64;
|
||||
__gettimeofday64;
|
||||
|
@ -203,6 +203,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -200,6 +200,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2290,6 +2290,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2244,6 +2244,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2427,6 +2427,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -204,6 +204,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2371,6 +2371,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2341,6 +2341,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2338,6 +2338,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2336,6 +2336,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2334,6 +2334,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2342,6 +2342,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2380,6 +2380,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2398,6 +2398,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2431,6 +2431,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2396,6 +2396,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2251,6 +2251,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2248,6 +2248,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
@ -2389,6 +2389,11 @@ GLIBC_2.34 __ctime64_r F
|
||||
GLIBC_2.34 __difftime64 F
|
||||
GLIBC_2.34 __fstat64_time64 F
|
||||
GLIBC_2.34 __fstatat64_time64 F
|
||||
GLIBC_2.34 __fts64_children_time64 F
|
||||
GLIBC_2.34 __fts64_close_time64 F
|
||||
GLIBC_2.34 __fts64_open_time64 F
|
||||
GLIBC_2.34 __fts64_read_time64 F
|
||||
GLIBC_2.34 __fts64_set_time64 F
|
||||
GLIBC_2.34 __futimens64 F
|
||||
GLIBC_2.34 __futimes64 F
|
||||
GLIBC_2.34 __futimesat64 F
|
||||
|
Loading…
Reference in New Issue
Block a user