From: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
To: qemu-devel@nongnu.org
Cc: aurelien@aurel32.net, arikalo@wavecomp.com,
amarkovic@wavecomp.com, smarkovic@wavecomp.com,
pjovanovic@wavecomp.com, riku.voipio@iki.fi, laurent@vivier.eu,
ysu@wavecomp.com
Subject: [Qemu-devel] [PATCH v2 2/3] linux-user: Add support for semtimedop() syscall
Date: Tue, 23 Oct 2018 15:07:35 +0200 [thread overview]
Message-ID: <1540300056-7935-3-git-send-email-aleksandar.markovic@rt-rk.com> (raw)
In-Reply-To: <1540300056-7935-1-git-send-email-aleksandar.markovic@rt-rk.com>
From: Aleksandar Rikalo <arikalo@wavecomp.com>
Add support for semtimedop() emulation.
Signed-off-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
linux-user/syscall.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8b01ab0..e722ba8 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6162,7 +6162,29 @@ static inline abi_long host_to_target_stat64(void *cpu_env,
return 0;
}
#endif
+#ifdef TARGET_NR_semtimedop
+static inline abi_long do_semtimedop(int semid, abi_long ptr, unsigned nsops,
+ abi_long timeout)
+{
+ struct sembuf sops[nsops];
+ struct timespec ts, *pts;
+
+ if (timeout) {
+ pts = &ts;
+ if (target_to_host_timespec(pts, timeout)) {
+ return -TARGET_EFAULT;
+ }
+ } else {
+ pts = NULL;
+ }
+ if (target_to_host_sembuf(sops, ptr, nsops)) {
+ return -TARGET_EFAULT;
+ }
+
+ return get_errno(semtimedop(semid, sops, nsops, pts));
+}
+#endif
/* ??? Using host futex calls even when target atomic operations
are not really atomic probably breaks things. However implementing
futexes locally would make futexes shared between multiple processes
@@ -8661,6 +8683,11 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_semget:
return get_errno(semget(arg1, arg2, arg3));
#endif
+#ifdef TARGET_NR_semtimedop
+ case TARGET_NR_semtimedop:
+ ret = do_semtimedop(arg1, arg2, arg3, arg4);
+ break;
+#endif
#ifdef TARGET_NR_semop
case TARGET_NR_semop:
return do_semop(arg1, arg2, arg3);
--
2.7.4
next prev parent reply other threads:[~2018-10-23 13:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-23 13:07 [Qemu-devel] [PATCH v2 0/3] linux-user: Support for misc features Aleksandar Markovic
2018-10-23 13:07 ` [Qemu-devel] [PATCH v2 1/3] linux-user: Add support for statx() syscall Aleksandar Markovic
2018-10-23 20:48 ` Laurent Vivier
2018-10-23 13:07 ` Aleksandar Markovic [this message]
2018-10-23 18:04 ` [Qemu-devel] [PATCH v2 2/3] linux-user: Add support for semtimedop() syscall Laurent Vivier
2018-10-23 13:07 ` [Qemu-devel] [PATCH v2 3/3] linux-user: Add support for SO_REUSEPORT Aleksandar Markovic
2018-10-23 17:49 ` Laurent Vivier
2018-11-12 15:29 ` Aleksandar Markovic
2018-11-12 15:39 ` Laurent Vivier
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=1540300056-7935-3-git-send-email-aleksandar.markovic@rt-rk.com \
--to=aleksandar.markovic@rt-rk.com \
--cc=amarkovic@wavecomp.com \
--cc=arikalo@wavecomp.com \
--cc=aurelien@aurel32.net \
--cc=laurent@vivier.eu \
--cc=pjovanovic@wavecomp.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
--cc=smarkovic@wavecomp.com \
--cc=ysu@wavecomp.com \
/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).