From 45dffe427d5ec323c14bceb9e1a983336ce0e2c2 Mon Sep 17 00:00:00 2001 From: ramin Date: Sat, 10 Dec 2022 17:49:13 +0100 Subject: gettimeofday() vdso support --- libc/sysdeps/linux/common/gettimeofday.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) mode change 100644 => 100755 libc/sysdeps/linux/common/gettimeofday.c (limited to 'libc') diff --git a/libc/sysdeps/linux/common/gettimeofday.c b/libc/sysdeps/linux/common/gettimeofday.c old mode 100644 new mode 100755 index 1c62b3937..e5141088e --- a/libc/sysdeps/linux/common/gettimeofday.c +++ b/libc/sysdeps/linux/common/gettimeofday.c @@ -9,5 +9,28 @@ #include #include -_syscall2(int, gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz) +#include "ldso.h" + + + +#ifdef __VDSO_SUPPORT__ +typedef int (*gettimeofday_func)(struct timeval * tv, __timezone_ptr_t tz); +#endif + +int gettimeofday(struct timeval * tv, __timezone_ptr_t tz) { + + #ifdef __VDSO_SUPPORT__ + if ( _dl__vdso_gettimeofday != 0 ){ + gettimeofday_func func= _dl__vdso_gettimeofday; + return func( tv, tz ); + + }else{ + _syscall2_body(int, gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz) + } + #else + _syscall2_body(int, gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz) + #endif +} + + libc_hidden_def(gettimeofday) -- cgit v1.2.3