summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorramin <lordrasmus@gmail.com>2022-12-10 17:49:13 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2022-12-19 10:56:47 +0100
commit45dffe427d5ec323c14bceb9e1a983336ce0e2c2 (patch)
treeedc128556f4cd7cf3a496acec274be7511a7af08
parentcf4f6ace3ecc2bf6e02ff1688ae90ca0017dca3c (diff)
gettimeofday() vdso support
-rwxr-xr-x[-rw-r--r--]libc/sysdeps/linux/common/gettimeofday.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/common/gettimeofday.c b/libc/sysdeps/linux/common/gettimeofday.c
index 1c62b3937..e5141088e 100644..100755
--- a/libc/sysdeps/linux/common/gettimeofday.c
+++ b/libc/sysdeps/linux/common/gettimeofday.c
@@ -9,5 +9,28 @@
#include <sys/syscall.h>
#include <sys/time.h>
-_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)