From: Kyle Evans <[email protected]>
+Add clock_nanosleep(2)
Provide sleep interval in nanoseconds and allows to choose which clock
to measure it against.
Signed-off-by: Ajeets6 <[email protected]>
Signed-off-by: Kyle Evans <[email protected]>
---
bsd-user/freebsd/os-time.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/bsd-user/freebsd/os-time.h b/bsd-user/freebsd/os-time.h
index 18c9e1dd12..29d2c8d02a 100644
--- a/bsd-user/freebsd/os-time.h
+++ b/bsd-user/freebsd/os-time.h
@@ -42,3 +42,24 @@ static inline abi_long do_freebsd_nanosleep(abi_long arg1,
abi_long arg2)
return ret;
}
+/* clock_nanosleep(2) */
+static inline abi_long do_freebsd_clock_nanosleep(abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4)
+{
+ struct timespec req, rem;
+ abi_long ret;
+ int clkid, flags;
+
+ clkid = arg1;
+ /* XXX Translate? */
+ flags = arg2;
+ ret = t2h_freebsd_timespec(&req, arg3);
+ if (!is_error(ret)) {
+ ret = get_errno(safe_clock_nanosleep(clkid, flags, &req, &rem));
+ if (ret == -TARGET_EINTR && arg4) {
+ h2t_freebsd_timespec(arg4, &rem);
+ }
+ }
+
+ return ret;
+}
--
2.34.1