qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ajeets6 <itachis6234@gmail.com>
To: itachis6234@gmail.com, qemu-devel@nongnu.org
Cc: imp@bsdimp.com, Kyle Evans <kevans@freebsd.org>
Subject: [PATCH 3/7] Add clock_nanosleep
Date: Sat, 22 Apr 2023 21:49:30 +0530	[thread overview]
Message-ID: <20230422161934.2311-3-itachis6234@gmail.com> (raw)
In-Reply-To: <20230422161934.2311-1-itachis6234@gmail.com>

From: Kyle Evans <kevans@freebsd.org>

+Add clock_nanosleep(2)
Provide sleep interval in nanoseconds and allows to choose which clock
to measure it against.
Signed-off-by: Ajeets6 <itachis6234@gmail.com>
Signed-off-by: Kyle Evans <kevans@freebsd.org>
---
 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



  parent reply	other threads:[~2023-04-22 17:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-22 16:19 [PATCH 1/7] Create os-time.c and add t2h_freebsd_timeval Ajeets6
2023-04-22 16:19 ` [PATCH 2/7] Create os-time.h and modify os-time.c Ajeets6
2023-04-22 16:19 ` Ajeets6 [this message]
2023-04-22 16:19 ` [PATCH 4/7] Added clock_gettime(2) and clock_getres(2) Ajeets6
2023-04-22 16:19 ` [PATCH 5/7] Created qemu-os.h for function prototype Ajeets6
2023-04-22 16:19 ` [PATCH 6/7] Added case staements for time functions Ajeets6
2023-04-22 16:19 ` [PATCH 7/7] Added safe_syscalls " Ajeets6

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230422161934.2311-3-itachis6234@gmail.com \
    --to=itachis6234@gmail.com \
    --cc=imp@bsdimp.com \
    --cc=kevans@freebsd.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).