1#include <shlib-compat.h>
2
3#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) \
4 && !defined(GLOB_NO_OLD_VERSION)
5
6#include <dirent.h>
7#include <glob.h>
8#include <sys/stat.h>
9
10#include <olddirent.h>
11
12int __old_glob64 (const char *__pattern, int __flags,
13 int (*__errfunc) (const char *, int),
14 glob64_t *__pglob);
15libc_hidden_proto (__old_glob64);
16
17#define dirent __old_dirent64
18#define GL_READDIR(pglob, stream) \
19 ((struct __old_dirent64 *) (pglob)->gl_readdir (stream))
20#undef __readdir
21#define __readdir(dirp) __old_readdir64 (dirp)
22
23#define glob_t glob64_t
24#define __glob(pattern, flags, errfunc, pglob) \
25 __old_glob64 (pattern, flags, errfunc, pglob)
26#define globfree(pglob) globfree64(pglob)
27
28#define convert_dirent __old_convert_dirent
29#define glob_in_dir __old_glob_in_dir
30
31#undef stat
32#define stat stat64
33#undef __stat
34#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
35
36/* Avoid calling gl_lstat with GLOB_ALTDIRFUNC. */
37#define GLOB_NO_LSTAT
38
39#define GLOB_ATTRIBUTE attribute_compat_text_section
40
41#include <posix/glob.c>
42
43libc_hidden_def (__old_glob64);
44
45compat_symbol (libc, __old_glob64, glob64, GLIBC_2_1);
46#endif
47