[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 10/49] linux-user: Split out readv, writev
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v6 10/49] linux-user: Split out readv, writev |
Date: |
Sat, 19 Jan 2019 08:30:43 +1100 |
Signed-off-by: Richard Henderson <address@hidden>
---
linux-user/syscall-defs.h | 2 ++
linux-user/syscall-file.inc.c | 34 ++++++++++++++++++++++++++++++++++
linux-user/syscall.c | 22 ----------------------
linux-user/strace.list | 6 ------
4 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h
index b031de1375..130ba7e344 100644
--- a/linux-user/syscall-defs.h
+++ b/linux-user/syscall-defs.h
@@ -28,4 +28,6 @@ SYSCALL_DEF(readlink, ARG_STR, ARG_PTR, ARG_DEC);
#ifdef TARGET_NR_readlinkat
SYSCALL_DEF(readlinkat, ARG_ATDIRFD, ARG_STR, ARG_PTR, ARG_DEC);
#endif
+SYSCALL_DEF(readv, ARG_DEC, ARG_PTR, ARG_DEC);
SYSCALL_DEF(write, ARG_DEC, ARG_PTR, ARG_DEC);
+SYSCALL_DEF(writev, ARG_DEC, ARG_PTR, ARG_DEC);
diff --git a/linux-user/syscall-file.inc.c b/linux-user/syscall-file.inc.c
index 9c8025b252..9bd21ac5cd 100644
--- a/linux-user/syscall-file.inc.c
+++ b/linux-user/syscall-file.inc.c
@@ -343,6 +343,23 @@ SYSCALL_IMPL(read)
return ret;
}
+SYSCALL_IMPL(readv)
+{
+ int fd = arg1;
+ abi_ulong target_vec = arg2;
+ int count = arg3;
+ struct iovec *vec = lock_iovec(VERIFY_WRITE, target_vec, count, 0);
+ abi_long ret;
+
+ if (vec != NULL) {
+ ret = get_errno(safe_readv(fd, vec, count));
+ unlock_iovec(vec, target_vec, count, 1);
+ } else {
+ ret = -host_to_target_errno(errno);
+ }
+ return ret;
+}
+
static abi_long do_readlinkat(int dirfd, abi_ulong target_path,
abi_ulong target_buf, abi_ulong bufsiz)
{
@@ -419,3 +436,20 @@ SYSCALL_IMPL(write)
unlock_user(p, target_p, 0);
return ret;
}
+
+SYSCALL_IMPL(writev)
+{
+ int fd = arg1;
+ abi_ulong target_vec = arg2;
+ int count = arg3;
+ struct iovec *vec = lock_iovec(VERIFY_READ, target_vec, count, 1);
+ abi_long ret;
+
+ if (vec != NULL) {
+ ret = get_errno(safe_writev(fd, vec, count));
+ unlock_iovec(vec, target_vec, count, 0);
+ } else {
+ ret = -host_to_target_errno(errno);
+ }
+ return ret;
+}
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c236a80437..df47ee106e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8949,28 +8949,6 @@ static abi_long do_syscall1(void *cpu_env, int num,
abi_long arg1,
/* NOTE: the flock constant seems to be the same for every
Linux platform */
return get_errno(safe_flock(arg1, arg2));
- case TARGET_NR_readv:
- {
- struct iovec *vec = lock_iovec(VERIFY_WRITE, arg2, arg3, 0);
- if (vec != NULL) {
- ret = get_errno(safe_readv(arg1, vec, arg3));
- unlock_iovec(vec, arg2, arg3, 1);
- } else {
- ret = -host_to_target_errno(errno);
- }
- }
- return ret;
- case TARGET_NR_writev:
- {
- struct iovec *vec = lock_iovec(VERIFY_READ, arg2, arg3, 1);
- if (vec != NULL) {
- ret = get_errno(safe_writev(arg1, vec, arg3));
- unlock_iovec(vec, arg2, arg3, 0);
- } else {
- ret = -host_to_target_errno(errno);
- }
- }
- return ret;
#if defined(TARGET_NR_preadv)
case TARGET_NR_preadv:
{
diff --git a/linux-user/strace.list b/linux-user/strace.list
index f3a1b0fe31..e02a854cea 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1073,9 +1073,6 @@
#ifdef TARGET_NR_readdir
{ TARGET_NR_readdir, "readdir" , NULL, NULL, NULL },
#endif
-#ifdef TARGET_NR_readv
-{ TARGET_NR_readv, "readv" , NULL, NULL, NULL },
-#endif
#ifdef TARGET_NR_reboot
{ TARGET_NR_reboot, "reboot" , NULL, NULL, NULL },
#endif
@@ -1608,9 +1605,6 @@
#ifdef TARGET_NR_waitpid
{ TARGET_NR_waitpid, "waitpid" , "%s(%d,%p,%#x)", NULL, NULL },
#endif
-#ifdef TARGET_NR_writev
-{ TARGET_NR_writev, "writev" , "%s(%d,%p,%#x)", NULL, NULL },
-#endif
#ifdef TARGET_NR_utimensat
{ TARGET_NR_utimensat, "utimensat", NULL, print_utimensat, NULL },
#endif
--
2.17.2
- [Qemu-devel] [PATCH v6 00/49] linux-user: Split do_syscall, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 05/49] linux-user: Tidy do_openat loop over fakes, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 07/49] linux-user: Split out close, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 04/49] linux-user: Share more code for open and openat, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 06/49] linux-user: Split out readlink, readlinkat, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 08/49] linux-user: Split out read, write, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 03/49] linux-user: Split out open, open_at, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 09/49] linux-user: Reduce regpairs_aligned & target_offset64 ifdefs, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 01/49] linux-user: Setup split syscall infrastructure, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 10/49] linux-user: Split out readv, writev,
Richard Henderson <=
- [Qemu-devel] [PATCH v6 11/49] linux-user: Split out pread64, pwrite64, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 12/49] linux-user: Split out preadv, pwritev, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 13/49] linux-user: Split out name_to_handle_at, open_by_handle_at, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 15/49] linux-user: Split out memory syscalls, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 16/49] linux-user: Split out exit, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 17/49] linux-user: Split out brk, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 14/49] linux-user: Split out ipc syscalls, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 18/49] linux-user: Split out clone, fork, vfork, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 19/49] linux-user: Split out wait4, waitid, waitpid, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 20/49] linux-user: Implement rusage argument to waitid, Richard Henderson, 2019/01/18