vgettimeofday.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * MIPS64 and compat userspace implementations of gettimeofday()
  4. * and similar.
  5. *
  6. * Copyright (C) 2015 Imagination Technologies
  7. * Copyright (C) 2018 ARM Limited
  8. *
  9. */
  10. #include <linux/time.h>
  11. #include <linux/types.h>
  12. #if _MIPS_SIM != _MIPS_SIM_ABI64
  13. int __vdso_clock_gettime(clockid_t clock,
  14. struct old_timespec32 *ts)
  15. {
  16. return __cvdso_clock_gettime32(clock, ts);
  17. }
  18. #ifdef CONFIG_MIPS_CLOCK_VSYSCALL
  19. /*
  20. * This is behind the ifdef so that we don't provide the symbol when there's no
  21. * possibility of there being a usable clocksource, because there's nothing we
  22. * can do without it. When libc fails the symbol lookup it should fall back on
  23. * the standard syscall path.
  24. */
  25. int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
  26. struct timezone *tz)
  27. {
  28. return __cvdso_gettimeofday(tv, tz);
  29. }
  30. #endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
  31. int __vdso_clock_getres(clockid_t clock_id,
  32. struct old_timespec32 *res)
  33. {
  34. return __cvdso_clock_getres_time32(clock_id, res);
  35. }
  36. int __vdso_clock_gettime64(clockid_t clock,
  37. struct __kernel_timespec *ts)
  38. {
  39. return __cvdso_clock_gettime(clock, ts);
  40. }
  41. #else
  42. int __vdso_clock_gettime(clockid_t clock,
  43. struct __kernel_timespec *ts)
  44. {
  45. return __cvdso_clock_gettime(clock, ts);
  46. }
  47. #ifdef CONFIG_MIPS_CLOCK_VSYSCALL
  48. /*
  49. * This is behind the ifdef so that we don't provide the symbol when there's no
  50. * possibility of there being a usable clocksource, because there's nothing we
  51. * can do without it. When libc fails the symbol lookup it should fall back on
  52. * the standard syscall path.
  53. */
  54. int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
  55. struct timezone *tz)
  56. {
  57. return __cvdso_gettimeofday(tv, tz);
  58. }
  59. #endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
  60. int __vdso_clock_getres(clockid_t clock_id,
  61. struct __kernel_timespec *res)
  62. {
  63. return __cvdso_clock_getres(clock_id, res);
  64. }
  65. #endif