[COMMIT osv master] vdso: make clock_gettime() return -errno if it fails

1 view
Skip to first unread message

Commit Bot

unread,
Dec 15, 2023, 1:24:22 PM12/15/23
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Waldemar Kozaczuk <jwkoz...@gmail.com>
Branch: master

vdso: make clock_gettime() return -errno if it fails

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>

---
diff --git a/libc/vdso/vdso.cc b/libc/vdso/vdso.cc
--- a/libc/vdso/vdso.cc
+++ b/libc/vdso/vdso.cc
@@ -21,7 +21,11 @@ extern "C" __attribute__((__visibility__("default")))
int __vdso_clock_gettime(clockid_t clk_id, struct timespec *tp)
{
arch::tls_switch _tls_switch;
- return clock_gettime(clk_id, tp);
+ if (clock_gettime(clk_id, tp) < 0) {
+ return -errno;
+ } else {
+ return 0;
+ }
}
#endif

@@ -35,7 +39,11 @@ int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz)
__attribute__((__visibility__("default")))
int __kernel_clock_gettime(clockid_t clk_id, struct timespec *tp)
{
- return clock_gettime(clk_id, tp);
+ if (clock_gettime(clk_id, tp) < 0) {
+ return -errno;
+ } else {
+ return 0;
+ }
}

__attribute__((__visibility__("default")))
Reply all
Reply to author
Forward
0 new messages