[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 20/22] linux-user: added support for preadv() syst
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL v2 20/22] linux-user: added support for preadv() system call. |
Date: |
Tue, 18 Oct 2016 16:21:48 +0300 |
From: Dejan Jovicevic <address@hidden>
This system call performs the same task as the readv() system call,
with the exception of having the fourth argument, offset, which
specifes the file offset at which the input operation is to be performed.
Because of this, the preadv() implementation is based on the readv()
implementation in linux-user mode.
But, since preadv() is implemented in the kernel as a 5-argument syscall,
5 arguments are needed to be handled as input and passed to the host
syscall.
The pos_l and pos_h argument of the safe_preadv() are of type unsigned
long, which can be of different sizes on different platforms. The input
arguments are converted to the appropriate host size when passed to
safe_preadv().
Signed-off-by: Dejan Jovicevic <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/syscall.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d85a0b5..9cb2a8f 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -919,6 +919,8 @@ safe_syscall2(int, tkill, int, tid, int, sig)
safe_syscall3(int, tgkill, int, tgid, int, pid, int, sig)
safe_syscall3(ssize_t, readv, int, fd, const struct iovec *, iov, int, iovcnt)
safe_syscall3(ssize_t, writev, int, fd, const struct iovec *, iov, int, iovcnt)
+safe_syscall5(ssize_t, preadv, int, fd, const struct iovec *, iov, int, iovcnt,
+ unsigned long, pos_l, unsigned long, pos_h)
safe_syscall3(int, connect, int, fd, const struct sockaddr *, addr,
socklen_t, addrlen)
safe_syscall6(ssize_t, sendto, int, fd, const void *, buf, size_t, len,
@@ -10078,6 +10080,19 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
}
}
break;
+#if defined(TARGET_NR_preadv)
+ case TARGET_NR_preadv:
+ {
+ struct iovec *vec = lock_iovec(VERIFY_WRITE, arg2, arg3, 0);
+ if (vec != NULL) {
+ ret = get_errno(safe_preadv(arg1, vec, arg3, arg4, arg5));
+ unlock_iovec(vec, arg2, arg3, 1);
+ } else {
+ ret = -host_to_target_errno(errno);
+ }
+ }
+ break;
+#endif
case TARGET_NR_getsid:
ret = get_errno(getsid(arg1));
break;
--
2.1.4
- [Qemu-devel] [PULL v2 09/22] linux-user: add kcmp() syscall, (continued)
- [Qemu-devel] [PULL v2 09/22] linux-user: add kcmp() syscall, riku . voipio, 2016/10/18
- [Qemu-devel] [PULL v2 16/22] linux-user: Update mips_syscall_args[] array in main.c, riku . voipio, 2016/10/18
- [Qemu-devel] [PULL v2 06/22] linux-user: Fix syslog() syscall support, riku . voipio, 2016/10/18
- [Qemu-devel] [PULL v2 10/22] linux-user: add RTA_PRIORITY in netlink, riku . voipio, 2016/10/18
- [Qemu-devel] [PULL v2 14/22] linux-user: Add support for clock_adjtime() syscall, riku . voipio, 2016/10/18
- [Qemu-devel] [PULL v2 19/22] linux-user: Fix fadvise64() syscall support for Mips32, riku . voipio, 2016/10/18
- [Qemu-devel] [PULL v2 15/22] linux-user: Add support for syncfs() syscall, riku . voipio, 2016/10/18
- [Qemu-devel] [PULL v2 17/22] linux-user: Update ioctls definitions for Mips32, riku . voipio, 2016/10/18
- [Qemu-devel] [PULL v2 18/22] linux-user: Redirect termbits.h for Mips64 to termbits.h for Mips32, riku . voipio, 2016/10/18
- [Qemu-devel] [PULL v2 22/22] linux-user: disable unicore32 linux-user build, riku . voipio, 2016/10/18
- [Qemu-devel] [PULL v2 20/22] linux-user: added support for preadv() system call.,
riku . voipio <=
- [Qemu-devel] [PULL v2 21/22] linux-user: added support for pwritev() system call., riku . voipio, 2016/10/18
- Re: [Qemu-devel] [PULL v2 00/22] linux-user changes, Peter Maydell, 2016/10/18