[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 32/44] linux-user: Use safe_syscall wrapper for mq_ti
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 32/44] linux-user: Use safe_syscall wrapper for mq_timedsend and mq_timedreceive |
Date: |
Wed, 8 Jun 2016 16:30:13 +0300 |
From: Peter Maydell <address@hidden>
Use the safe_syscall wrapper for mq_timedsend and mq_timedreceive syscalls.
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/syscall.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b41d269..294e5ee 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -750,6 +750,12 @@ static int safe_msgrcv(int msgid, void *msgp, size_t sz,
long type, int flags)
return safe_ipc(Q_IPCCALL(1, Q_MSGRCV), msgid, sz, flags, msgp, type);
}
#endif
+#if defined(TARGET_NR_mq_open) && defined(__NR_mq_open)
+safe_syscall5(int, mq_timedsend, int, mqdes, const char *, msg_ptr,
+ size_t, len, unsigned, prio, const struct timespec *, timeout)
+safe_syscall5(int, mq_timedreceive, int, mqdes, char *, msg_ptr,
+ size_t, len, unsigned *, prio, const struct timespec *, timeout)
+#endif
static inline int host_to_target_sock_type(int host_type)
{
@@ -10593,11 +10599,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
p = lock_user (VERIFY_READ, arg2, arg3, 1);
if (arg5 != 0) {
target_to_host_timespec(&ts, arg5);
- ret = get_errno(mq_timedsend(arg1, p, arg3, arg4, &ts));
+ ret = get_errno(safe_mq_timedsend(arg1, p, arg3, arg4, &ts));
host_to_target_timespec(arg5, &ts);
+ } else {
+ ret = get_errno(safe_mq_timedsend(arg1, p, arg3, arg4, NULL));
}
- else
- ret = get_errno(mq_send(arg1, p, arg3, arg4));
unlock_user (p, arg2, arg3);
}
break;
@@ -10610,11 +10616,13 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
p = lock_user (VERIFY_READ, arg2, arg3, 1);
if (arg5 != 0) {
target_to_host_timespec(&ts, arg5);
- ret = get_errno(mq_timedreceive(arg1, p, arg3, &prio, &ts));
+ ret = get_errno(safe_mq_timedreceive(arg1, p, arg3,
+ &prio, &ts));
host_to_target_timespec(arg5, &ts);
+ } else {
+ ret = get_errno(safe_mq_timedreceive(arg1, p, arg3,
+ &prio, NULL));
}
- else
- ret = get_errno(mq_receive(arg1, p, arg3, &prio));
unlock_user (p, arg2, arg3);
if (arg4 != 0)
put_user_u32(prio, arg4);
--
2.1.4
- [Qemu-devel] [PULL 21/44] linux-user: Restart fork() if signals pending, (continued)
- [Qemu-devel] [PULL 21/44] linux-user: Restart fork() if signals pending, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 28/44] linux-user: Use safe_syscall wrapper for readv and writev syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 22/44] linux-user: Use both si_code and si_signo when converting siginfo_t, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 26/44] linux-user: Fix NR_fadvise64 and NR_fadvise64_64 for 32-bit guests, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 33/44] linux-user: Use safe_syscall wrapper for flock, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 30/44] linux-user: Use safe_syscall wrapper for send* and recv* syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 29/44] linux-user: Use safe_syscall wrapper for connect syscall, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 37/44] linux-user: Use safe_syscall wrapper for epoll_wait syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 27/44] linux-user: Fix error conversion in 64-bit fadvise syscall, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 36/44] linux-user: Use safe_syscall wrapper for poll and ppoll syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 32/44] linux-user: Use safe_syscall wrapper for mq_timedsend and mq_timedreceive,
riku . voipio <=
- [Qemu-devel] [PULL 35/44] linux-user: Use safe_syscall wrapper for sleep syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 31/44] linux-user: Use safe_syscall wrapper for msgsnd and msgrcv, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 38/44] linux-user: Use safe_syscall wrapper for semop, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 39/44] linux-user: Use safe_syscall wrapper for accept and accept4 syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 41/44] linux-user: Correct signedness of target_flock l_start and l_len fields, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 43/44] linux-user: Special-case ERESTARTSYS in target_strerror(), riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 34/44] linux-user: Use safe_syscall wrapper for rt_sigtimedwait syscall, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 40/44] linux-user: Use safe_syscall wrapper for ioctl, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 42/44] linux-user: Make target_strerror() return 'const char *', riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 44/44] linux-user: In fork_end(), remove correct CPUs from CPU list, riku . voipio, 2016/06/08