hooks.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Compatibility code for malloc debugging and state management.
  2. Copyright (C) 2001-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 License as
  6. published by the Free Software Foundation; either version 2.1 of the
  7. 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; see the file COPYING.LIB. If
  14. not, see <https://www.gnu.org/licenses/>. */
  15. #ifndef weak_variable
  16. # define weak_variable weak_function
  17. #endif
  18. #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_24)
  19. void (*__malloc_initialize_hook) (void);
  20. compat_symbol (libc, __malloc_initialize_hook,
  21. __malloc_initialize_hook, GLIBC_2_0);
  22. #endif
  23. #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_34)
  24. void weak_variable (*__after_morecore_hook) (void) = NULL;
  25. compat_symbol (libc, __after_morecore_hook, __after_morecore_hook, GLIBC_2_0);
  26. void *(*__morecore)(ptrdiff_t);
  27. compat_symbol (libc, __morecore, __morecore, GLIBC_2_0);
  28. void weak_variable (*__free_hook) (void *, const void *) = NULL;
  29. void *weak_variable (*__malloc_hook) (size_t, const void *) = NULL;
  30. void *weak_variable (*__realloc_hook) (void *, size_t, const void *) = NULL;
  31. void *weak_variable (*__memalign_hook) (size_t, size_t, const void *) = NULL;
  32. compat_symbol (libc, __free_hook, __free_hook, GLIBC_2_0);
  33. compat_symbol (libc, __malloc_hook, __malloc_hook, GLIBC_2_0);
  34. compat_symbol (libc, __realloc_hook, __realloc_hook, GLIBC_2_0);
  35. compat_symbol (libc, __memalign_hook, __memalign_hook, GLIBC_2_0);
  36. #endif
  37. /*
  38. * Local variables:
  39. * c-basic-offset: 2
  40. * End:
  41. */