init-first.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* Copyright (C) 2007-2019 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public License as
  5. published by the Free Software Foundation; either version 2.1 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <http://www.gnu.org/licenses/>. */
  14. #include <dl-vdso.h>
  15. #include <libc-vdso.h>
  16. int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) attribute_hidden;
  17. int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
  18. int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
  19. static inline void
  20. _libc_vdso_platform_setup (void)
  21. {
  22. #ifdef __LP64__
  23. PREPARE_VERSION (linux_version, "LINUX_2.6.39", 123718537);
  24. #else
  25. PREPARE_VERSION (linux_version, "LINUX_4.9", 61765625);
  26. #endif
  27. void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux_version);
  28. PTR_MANGLE (p);
  29. VDSO_SYMBOL(gettimeofday) = p;
  30. p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux_version);
  31. PTR_MANGLE (p);
  32. VDSO_SYMBOL(clock_gettime) = p;
  33. p = _dl_vdso_vsym ("__kernel_clock_getres", &linux_version);
  34. PTR_MANGLE (p);
  35. VDSO_SYMBOL(clock_getres) = p;
  36. }
  37. #define VDSO_SETUP _libc_vdso_platform_setup
  38. #include <csu/init-first.c>