mirror of https://gitee.com/Nocallback/glibc.git
Browse Source
The glob might pass a different stat struct for gl_stat and gl_lstat when GLOB_ALTDIRFUNC is used. This requires add a new 64-bit time version that also uses 64-bit time stat functions. Checked on i686-linux-gnu and x86_64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>codonell/c-utf8
35 changed files with 307 additions and 40 deletions
@ -0,0 +1,49 @@ |
|||
/* Long File Support glob with 64-bit time support.
|
|||
Copyright (C) 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 <errno.h> |
|||
#include <glob.h> |
|||
#include <stddef.h> |
|||
|
|||
#if __TIMESIZE != 64 |
|||
|
|||
/* Do glob searching for PATTERN, placing results in PGLOB.
|
|||
The bits defined above may be set in FLAGS. |
|||
If a directory cannot be opened or read and ERRFUNC is not nil, |
|||
it is called with the pathname that caused the error, and the |
|||
`errno' value from the failing call; if it returns non-zero |
|||
`glob' returns GLOB_ABORTED; if it returns zero, the error is ignored. |
|||
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. |
|||
Otherwise, `glob' returns zero. */ |
|||
int |
|||
__glob64_time64 (const char *pattern, int flags, |
|||
int (*errfunc) (const char *, int), glob64_time64_t *pglob) |
|||
{ |
|||
if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0) |
|||
{ |
|||
__set_errno (EINVAL); |
|||
return -1; |
|||
} |
|||
|
|||
__set_errno (ENOSYS); |
|||
return GLOB_NOSYS; |
|||
} |
|||
|
|||
stub_warning (glob64) |
|||
|
|||
#endif |
|||
@ -0,0 +1,30 @@ |
|||
/* Long File Support globfree with 64-bit time support.
|
|||
Copyright (C) 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 <glob.h> |
|||
|
|||
#if __TIMESIZE != 64 |
|||
|
|||
/* Free storage allocated in PGLOB by a previous `glob' call. */ |
|||
void |
|||
__globfree64_time64 (glob64_time64_t *pglob) |
|||
{ |
|||
} |
|||
libc_hidden_def (__globfree64_time64) |
|||
|
|||
#endif |
|||
@ -0,0 +1,44 @@ |
|||
/* Find pathnames matching a pattern. Linux version.
|
|||
Copyright (C) 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 <sys/stat.h> |
|||
|
|||
#if __TIMESIZE != 64 |
|||
# include <glob.h> |
|||
# include <dirent.h> |
|||
# include <sys/stat.h> |
|||
|
|||
# define dirent dirent64 |
|||
# define __readdir(dirp) __readdir64 (dirp) |
|||
|
|||
# define glob_t glob64_time64_t |
|||
# define __glob __glob64_time64 |
|||
|
|||
# define globfree(pglob) __globfree64_time64 (pglob) |
|||
|
|||
# define COMPILE_GLOB64 1 |
|||
# define struct_stat struct __stat64_t64 |
|||
# define struct_stat64 struct __stat64_t64 |
|||
# define GLOB_LSTAT gl_lstat |
|||
# define GLOB_STAT64 __stat64_time64 |
|||
# define GLOB_LSTAT64 __lstat64_time64 |
|||
|
|||
# define COMPILE_GLOB64 1 |
|||
|
|||
# include <posix/glob.c> |
|||
#endif |
|||
@ -0,0 +1,35 @@ |
|||
/* Frees the dynamically allocated storage from an earlier call to glob.
|
|||
Linux version. |
|||
Copyright (C) 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 <sys/stat.h> |
|||
|
|||
#if __TIMESIZE != 64 |
|||
# include <glob.h> |
|||
# include <dirent.h> |
|||
# include <sys/stat.h> |
|||
|
|||
# define glob_t glob64_time64_t |
|||
# define globfree(pglob) __globfree64_time64 (pglob) |
|||
|
|||
# undef stat |
|||
# define stat __stat64_t64 |
|||
|
|||
# include <posix/globfree.c> |
|||
libc_hidden_def (__globfree64_time64) |
|||
#endif |
|||
Loading…
Reference in new issue