vgettimeofday.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. #include <vdso/gettime.h>
  13. #if _MIPS_SIM != _MIPS_SIM_ABI64
  14. int __vdso_clock_gettime(clockid_t clock,
  15. struct old_timespec32 *ts)
  16. {
  17. return __cvdso_clock_gettime32(clock, ts);
  18. }
  19. #ifdef CONFIG_MIPS_CLOCK_VSYSCALL
  20. /*
  21. * This is behind the ifdef so that we don't provide the symbol when there's no
  22. * possibility of there being a usable clocksource, because there's nothing we
  23. * can do without it. When libc fails the symbol lookup it should fall back on
  24. * the standard syscall path.
  25. */
  26. int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
  27. struct timezone *tz)
  28. {
  29. return __cvdso_gettimeofday(tv, tz);
  30. }
  31. #endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
  32. int __vdso_clock_getres(clockid_t clock_id,
  33. struct old_timespec32 *res)
  34. {
  35. return __cvdso_clock_getres_time32(clock_id, res);
  36. }
  37. int __vdso_clock_gettime64(clockid_t clock,
  38. struct __kernel_timespec *ts)
  39. {
  40. return __cvdso_clock_gettime(clock, ts);
  41. }
  42. int __vdso_clock_getres_time64(clockid_t clock, struct __kernel_timespec *ts)
  43. {
  44. return __cvdso_clock_getres(clock, ts);
  45. }
  46. #else
  47. int __vdso_clock_gettime(clockid_t clock,
  48. struct __kernel_timespec *ts)
  49. {
  50. return __cvdso_clock_gettime(clock, ts);
  51. }
  52. #ifdef CONFIG_MIPS_CLOCK_VSYSCALL
  53. /*
  54. * This is behind the ifdef so that we don't provide the symbol when there's no
  55. * possibility of there being a usable clocksource, because there's nothing we
  56. * can do without it. When libc fails the symbol lookup it should fall back on
  57. * the standard syscall path.
  58. */
  59. int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
  60. struct timezone *tz)
  61. {
  62. return __cvdso_gettimeofday(tv, tz);
  63. }
  64. #endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
  65. int __vdso_clock_getres(clockid_t clock_id,
  66. struct __kernel_timespec *res)
  67. {
  68. return __cvdso_clock_getres(clock_id, res);
  69. }
  70. #endif