dl-cache.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
  2. Copyright (C) 1999-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #define _DL_CACHE_DEFAULT_ID 0x303
  16. #define _dl_cache_check_flags(flags) \
  17. ((flags) == _DL_CACHE_DEFAULT_ID)
  18. #define add_system_dir(dir) \
  19. do \
  20. { \
  21. size_t len = strlen (dir); \
  22. char path[len + 4]; \
  23. memcpy (path, dir, len + 1); \
  24. if (len >= 6 && ! memcmp (path + len - 6, "/lib64", 6)) \
  25. { \
  26. len -= 2; \
  27. path[len] = '\0'; \
  28. } \
  29. else if (len >= 7 \
  30. && ! memcmp (path + len - 7, "/libx32", 7)) \
  31. { \
  32. len -= 3; \
  33. path[len] = '\0'; \
  34. } \
  35. add_dir (path); \
  36. if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4)) \
  37. { \
  38. memcpy (path + len, "64", 3); \
  39. add_dir (path); \
  40. memcpy (path + len, "x32", 4); \
  41. add_dir (path); \
  42. } \
  43. } while (0)
  44. #include <sysdeps/generic/dl-cache.h>