@@ -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);
@@ -349,6 +349,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)
{
@@ -425,3 +442,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;
+}
@@ -9005,28 +9005,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:
{
@@ -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
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- 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(-)