glob64-lstat-compat.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* Compat glob which does not use gl_lstat for GLOB_ALTDIRFUNC.
  2. Linux version which handles LFS when required.
  3. Copyright (C) 2017-2019 Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, see
  15. <http://www.gnu.org/licenses/>. */
  16. #include <sys/stat.h>
  17. #include <kernel_stat.h>
  18. #if !XSTAT_IS_XSTAT64
  19. # include <glob.h>
  20. # include <dirent.h>
  21. # include <sys/stat.h>
  22. # include <shlib-compat.h>
  23. # define dirent dirent64
  24. # define __readdir(dirp) __readdir64 (dirp)
  25. # define glob_t glob64_t
  26. # define __glob __glob64_lstat_compat
  27. # define globfree globfree64
  28. # undef stat
  29. # define stat stat64
  30. # define COMPILE_GLOB64 1
  31. # define GLOB_ATTRIBUTE attribute_compat_text_section
  32. /* Avoid calling gl_lstat with GLOB_ALTDIRFUNC. */
  33. # define GLOB_NO_LSTAT
  34. # include <posix/glob.c>
  35. # if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_27)
  36. # ifndef GLOB_NO_OLD_VERSION
  37. # define GLOB_LSTAT_START_VER GLIBC_2_2
  38. # else
  39. # define GLOB_LSTAT_START_VER GLIBC_2_1
  40. # endif
  41. compat_symbol (libc, __glob64_lstat_compat, glob64, GLOB_LSTAT_START_VER);
  42. # endif
  43. #endif /* XSTAT_IS_XSTAT64 */