feat: use vDSO clock_gettime
Instead of doing a costly syscall, use a potential VDSO clock_gettime function.
See man(7) vdso
@@ -175,6 +175,16 @@ impl Request {
let rax: usize;
let rdx: usize;
+ if i64::from(self.num) == libc::SYS_clock_gettime {
+ let mut ret = libc::clock_gettime(usize::from(self.arg[0]) as _, self.arg[1].into());
+ if ret != 0 {
+ ret = *libc::__errno_location();
+ }
+ Reply {
+ ret: [ret.into(), 0.into()],
+ err: Default::default(),
+ }
+ } else {
asm!(
"syscall",
inlateout("rax") usize::from(self.num) => rax,
@@ -194,6 +204,7 @@ impl Request {
}
}
}
+}
/// A reply
///
