[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/7] Added clock_gettime(2) and clock_getres(2)
From: |
Ajeets6 |
Subject: |
[PATCH 4/7] Added clock_gettime(2) and clock_getres(2) |
Date: |
Sat, 22 Apr 2023 21:49:31 +0530 |
From: Stacey Son <sson@FreeBSD.org>
+Added clock_gettime(2) which gets the time
+Added clock_getres(2) which finds the resoultion of the specidfied
clock
Signed-off-by: Ajeets6 <itachis6234@gmail.com>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
---
bsd-user/freebsd/os-time.h | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/bsd-user/freebsd/os-time.h b/bsd-user/freebsd/os-time.h
index 29d2c8d02a..f76744e808 100644
--- a/bsd-user/freebsd/os-time.h
+++ b/bsd-user/freebsd/os-time.h
@@ -63,3 +63,35 @@ static inline abi_long do_freebsd_clock_nanosleep(abi_long
arg1, abi_long arg2,
return ret;
}
+
+/* clock_gettime(2) */
+static inline abi_long do_freebsd_clock_gettime(abi_long arg1, abi_long arg2)
+{
+ abi_long ret;
+ struct timespec ts;
+
+ ret = get_errno(clock_gettime(arg1, &ts));
+ if (!is_error(ret)) {
+ if (h2t_freebsd_timespec(arg2, &ts)) {
+ return -TARGET_EFAULT;
+ }
+ }
+
+ return ret;
+}
+
+/* clock_getres(2) */
+static inline abi_long do_freebsd_clock_getres(abi_long arg1, abi_long arg2)
+{
+ abi_long ret;
+ struct timespec ts;
+
+ ret = get_errno(clock_getres(arg1, &ts));
+ if (!is_error(ret)) {
+ if (h2t_freebsd_timespec(arg2, &ts)) {
+ return -TARGET_EFAULT;
+ }
+ }
+
+ return ret;
+}
\ No newline at end of file
--
2.34.1
- [PATCH 1/7] Create os-time.c and add t2h_freebsd_timeval, Ajeets6, 2023/04/22
- [PATCH 5/7] Created qemu-os.h for function prototype, Ajeets6, 2023/04/22
- [PATCH 2/7] Create os-time.h and modify os-time.c, Ajeets6, 2023/04/22
- [PATCH 6/7] Added case staements for time functions, Ajeets6, 2023/04/22
- [PATCH 4/7] Added clock_gettime(2) and clock_getres(2),
Ajeets6 <=
- [PATCH 3/7] Add clock_nanosleep, Ajeets6, 2023/04/22
- [PATCH 7/7] Added safe_syscalls for time functions., Ajeets6, 2023/04/22