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  
      12  int __old_glob64 (const char *__pattern, int __flags,
      13  		  int (*__errfunc) (const char *, int),
      14  		  glob64_t *__pglob);
      15  libc_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  /* Avoid calling gl_lstat with GLOB_ALTDIRFUNC.  */
      32  #define struct_stat    struct stat64
      33  #define struct_stat64  struct stat64
      34  #define GLOB_LSTAT     gl_stat
      35  #define GLOB_STAT64    __stat64
      36  #define GLOB_LSTAT64   __stat64
      37  
      38  #define GLOB_ATTRIBUTE attribute_compat_text_section
      39  
      40  #include <posix/glob.c>
      41  
      42  libc_hidden_def (__old_glob64);
      43  
      44  compat_symbol (libc, __old_glob64, glob64, GLIBC_2_1);
      45  #endif