xref: /linux/arch/powerpc/kernel/vdso/vgettimeofday.c (revision 369cecd238ac8317cccd27cf2452a8a6b6da1581)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Powerpc userspace implementations of gettimeofday() and similar.
4  */
5 #include <linux/time.h>
6 #include <linux/types.h>
7 
8 #ifdef __powerpc64__
9 int __c_kernel_clock_gettime(clockid_t clock, struct __kernel_timespec *ts,
10 			     const struct vdso_time_data *vd)
11 {
12 	return __cvdso_clock_gettime_data(vd, clock, ts);
13 }
14 
15 int __c_kernel_clock_getres(clockid_t clock_id, struct __kernel_timespec *res,
16 			    const struct vdso_time_data *vd)
17 {
18 	return __cvdso_clock_getres_data(vd, clock_id, res);
19 }
20 #else
21 #ifdef CONFIG_COMPAT_32BIT_TIME
22 int __c_kernel_clock_gettime(clockid_t clock, struct old_timespec32 *ts,
23 			     const struct vdso_time_data *vd)
24 {
25 	return __cvdso_clock_gettime32_data(vd, clock, ts);
26 }
27 
28 int __c_kernel_clock_getres(clockid_t clock_id, struct old_timespec32 *res,
29 			    const struct vdso_time_data *vd)
30 {
31 	return __cvdso_clock_getres_time32_data(vd, clock_id, res);
32 }
33 #endif /* CONFIG_COMPAT_32BIT_TIME */
34 
35 int __c_kernel_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts,
36 			       const struct vdso_time_data *vd)
37 {
38 	return __cvdso_clock_gettime_data(vd, clock, ts);
39 }
40 
41 int __c_kernel_clock_getres_time64(clockid_t clock_id, struct __kernel_timespec *res,
42 				   const struct vdso_time_data *vd)
43 {
44 	return __cvdso_clock_getres_data(vd, clock_id, res);
45 }
46 #endif
47 
48 #if defined(__powerpc64__) || defined(CONFIG_COMPAT_32BIT_TIME)
49 int __c_kernel_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz,
50 			    const struct vdso_time_data *vd)
51 {
52 	return __cvdso_gettimeofday_data(vd, tv, tz);
53 }
54 
55 __kernel_old_time_t __c_kernel_time(__kernel_old_time_t *time, const struct vdso_time_data *vd)
56 {
57 	return __cvdso_time_data(vd, time);
58 }
59 #endif
60