* [Qemu-devel] [PATCH v3 0/2] linux-user: preadv and pwritev emulation support
@ 2016-10-11 9:52 Dejan Jovicevic
2016-10-11 9:52 ` [Qemu-devel] [PATCH v3 1/2] linux-user: added support for preadv() system call Dejan Jovicevic
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dejan Jovicevic @ 2016-10-11 9:52 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
v2 -> v3:
- Changed from safe_syscall4() to safe_syscall5() to rightly fit the
kernel implementation of preadv() and pwritev().
- Modified commit message.
v1 -> v2:
- Being that both of these system calls are interruptible, in QEMU
they should be implemented via the safe_syscall() wrapper. This
version implements the preadv() and pwritev() using safe_preadv()
and safe_pwritev() for the respective syscalls, as suggested.
As the result of these changes, the patch from the v1 that checks
the support of pwritev on the host is dropped.
In this series the support for preadv and pwritev system call emulation
in linux-user mode is implemented.
Dejan Jovicevic (2):
linux-user: added support for preadv() system call.
linux-user: added support for pwritev() system call.
linux-user/syscall.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH v3 1/2] linux-user: added support for preadv() system call.
2016-10-11 9:52 [Qemu-devel] [PATCH v3 0/2] linux-user: preadv and pwritev emulation support Dejan Jovicevic
@ 2016-10-11 9:52 ` Dejan Jovicevic
2016-10-11 9:52 ` [Qemu-devel] [PATCH v3 2/2] linux-user: added support for pwritev() " Dejan Jovicevic
2016-10-17 13:04 ` [Qemu-devel] [PATCH v3 0/2] linux-user: preadv and pwritev emulation support Riku Voipio
2 siblings, 0 replies; 4+ messages in thread
From: Dejan Jovicevic @ 2016-10-11 9:52 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
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 <dejan.jovicevic@rt-rk.com>
---
linux-user/syscall.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 0815f30..048d9fa 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -908,6 +908,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,
@@ -9894,6 +9896,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;
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH v3 2/2] linux-user: added support for pwritev() system call.
2016-10-11 9:52 [Qemu-devel] [PATCH v3 0/2] linux-user: preadv and pwritev emulation support Dejan Jovicevic
2016-10-11 9:52 ` [Qemu-devel] [PATCH v3 1/2] linux-user: added support for preadv() system call Dejan Jovicevic
@ 2016-10-11 9:52 ` Dejan Jovicevic
2016-10-17 13:04 ` [Qemu-devel] [PATCH v3 0/2] linux-user: preadv and pwritev emulation support Riku Voipio
2 siblings, 0 replies; 4+ messages in thread
From: Dejan Jovicevic @ 2016-10-11 9:52 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
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>
---
linux-user/syscall.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 048d9fa..ecfe7ca 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -910,6 +910,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,
@@ -9909,6 +9911,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;
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v3 0/2] linux-user: preadv and pwritev emulation support
2016-10-11 9:52 [Qemu-devel] [PATCH v3 0/2] linux-user: preadv and pwritev emulation support Dejan Jovicevic
2016-10-11 9:52 ` [Qemu-devel] [PATCH v3 1/2] linux-user: added support for preadv() system call Dejan Jovicevic
2016-10-11 9:52 ` [Qemu-devel] [PATCH v3 2/2] linux-user: added support for pwritev() " Dejan Jovicevic
@ 2016-10-17 13:04 ` Riku Voipio
2 siblings, 0 replies; 4+ messages in thread
From: Riku Voipio @ 2016-10-17 13:04 UTC (permalink / raw)
To: Dejan Jovicevic; +Cc: qemu-devel
On Tue, Oct 11, 2016 at 11:52:45AM +0200, Dejan Jovicevic wrote:
> v2 -> v3:
> - Changed from safe_syscall4() to safe_syscall5() to rightly fit the
> kernel implementation of preadv() and pwritev().
> - Modified commit message.
>
> v1 -> v2:
> - Being that both of these system calls are interruptible, in QEMU
> they should be implemented via the safe_syscall() wrapper. This
> version implements the preadv() and pwritev() using safe_preadv()
> and safe_pwritev() for the respective syscalls, as suggested.
> As the result of these changes, the patch from the v1 that checks
> the support of pwritev on the host is dropped.
>
> In this series the support for preadv and pwritev system call emulation
> in linux-user mode is implemented.
Applied to linux-user, thanks
> Dejan Jovicevic (2):
> linux-user: added support for preadv() system call.
> linux-user: added support for pwritev() system call.
>
> linux-user/syscall.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-17 13:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-11 9:52 [Qemu-devel] [PATCH v3 0/2] linux-user: preadv and pwritev emulation support Dejan Jovicevic
2016-10-11 9:52 ` [Qemu-devel] [PATCH v3 1/2] linux-user: added support for preadv() system call Dejan Jovicevic
2016-10-11 9:52 ` [Qemu-devel] [PATCH v3 2/2] linux-user: added support for pwritev() " Dejan Jovicevic
2016-10-17 13:04 ` [Qemu-devel] [PATCH v3 0/2] linux-user: preadv and pwritev emulation support Riku Voipio
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).