From: riku.voipio@linaro.org
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
Subject: [Qemu-devel] [PULL v2 21/22] linux-user: added support for pwritev() system call.
Date: Tue, 18 Oct 2016 16:21:49 +0300 [thread overview]
Message-ID: <1a607f6bd93f1c3635fa097029a983335f7949f8.1476796525.git.riku.voipio@linaro.org> (raw)
In-Reply-To: <cover.1476796525.git.riku.voipio@linaro.org>
From: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
This system call performs the same task as the writev() 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 pwritev() implementation is based on the writev()
implementation in linux-user mode.
But, since pwritev() 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_pwritev() 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_pwritev().
Signed-off-by: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
linux-user/syscall.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9cb2a8f..dfc483c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -921,6 +921,8 @@ 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_syscall5(ssize_t, pwritev, 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,
@@ -10093,6 +10095,19 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
}
break;
#endif
+#if defined(TARGET_NR_pwritev)
+ case TARGET_NR_pwritev:
+ {
+ struct iovec *vec = lock_iovec(VERIFY_READ, arg2, arg3, 1);
+ if (vec != NULL) {
+ ret = get_errno(safe_pwritev(arg1, vec, arg3, arg4, arg5));
+ unlock_iovec(vec, arg2, arg3, 0);
+ } else {
+ ret = -host_to_target_errno(errno);
+ }
+ }
+ break;
+#endif
case TARGET_NR_getsid:
ret = get_errno(getsid(arg1));
break;
--
2.1.4
next prev parent reply other threads:[~2016-10-18 13:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-18 13:21 [Qemu-devel] [PULL v2 00/22] linux-user changes riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 01/22] linux-user: Add support for adjtimex() syscall riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 02/22] linux-user: Add support for ustat() syscall riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 03/22] linux-user: Fix mq_open() syscall support riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 04/22] linux-user: Fix msgrcv() and msgsnd() syscalls support riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 05/22] linux-user: Fix socketcall() syscall support riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 06/22] linux-user: Fix syslog() " riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 07/22] linux-user: Remove a duplicate item from strace.list riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 08/22] linux-user: sparc64: Use correct target SHMLBA in shmat() riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 09/22] linux-user: add kcmp() syscall riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 10/22] linux-user: add RTA_PRIORITY in netlink riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 11/22] linux-user: Don't use alloca() for epoll_wait's epoll event array riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 12/22] linux-user: use libc wrapper instead of direct mremap syscall riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 13/22] linux-user: Fix definition of target_sigevent for 32-bit guests riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 14/22] linux-user: Add support for clock_adjtime() syscall riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 15/22] linux-user: Add support for syncfs() syscall riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 16/22] linux-user: Update mips_syscall_args[] array in main.c riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 17/22] linux-user: Update ioctls definitions for Mips32 riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 18/22] linux-user: Redirect termbits.h for Mips64 to termbits.h " riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 19/22] linux-user: Fix fadvise64() syscall support " riku.voipio
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 20/22] linux-user: added support for preadv() system call riku.voipio
2016-10-18 13:21 ` riku.voipio [this message]
2016-10-18 13:21 ` [Qemu-devel] [PULL v2 22/22] linux-user: disable unicore32 linux-user build riku.voipio
2016-10-18 15:37 ` [Qemu-devel] [PULL v2 00/22] linux-user changes Peter Maydell
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=1a607f6bd93f1c3635fa097029a983335f7949f8.1476796525.git.riku.voipio@linaro.org \
--to=riku.voipio@linaro.org \
--cc=dejan.jovicevic@rt-rk.com \
--cc=peter.maydell@linaro.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).