From patchwork Sun May 19 20:36:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164508 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4787641ili; Sun, 19 May 2019 13:53:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxM2wot4T0ugbppC9iuYiPgBZz1lyHvhEk2TaAGTYdHOF9OZHiPwBKf6fu0/TheRznQc+3b X-Received: by 2002:a17:906:e9d3:: with SMTP id kb19mr13577462ejb.248.1558299198663; Sun, 19 May 2019 13:53:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558299198; cv=none; d=google.com; s=arc-20160816; b=qLcvowU1HhsfIXRyBt4AuZBoHCXqasjQ01x3XzN5dHyrj24MbELbiHqEUHwNFCUa2n MatyIhSnzl6iEB+Bl5sb5Nf4l8GcviNUTn+3fKfGU77pmmkYIhg21mC/oepmGAzRCFSS TV9qJ9C7sjo9rbYRFa6ZqWhXomP5DHefLYoD5AKmyxynJRpAdLxwqoASTXPRfuBKdQTY qhUecEUQxVJVMYJ92OQU5E182XqhikhiZkDbykKYpKxoaXDUdVBF9RFC+Q+ZcHsWCBhF rvW4n/sv7+8YzW4zqsrfmuCngqP9QBNZfmycrY3EEE68ik5jPvntY+kPC5wBIhWvWIyz QYJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=JWb0gO0FR8omCjsq9CBOm7HqleJuQXyRTIuggbhXR0I=; b=Q9ZqT4O82kbkuTkkjHeK11rf/WrdR1suoGA+kGtpdd1MTNWHnL5P5J0zAjncuKjvGZ NKsugFC2igsJyBIgDIa2DjMmV3HXQ0wwItDY5EhQEziEAdAF+mqA1WJQ+t3K8eEMmeNV v58MV+aNRRHhKNa0UCmR6/Ly/3c2XtJgUoZgJ2wwK/o4kqHTllyYJ5h92eT8xgyaCinP ItpHigPQ5nM5qfppXG7pDC4Zsv5sFrSD66lU0S7qoeszQdlEC6wfrU4Z1PyYALlEs+m7 1q9CnAke5NHOMur7h1n560eCLr2VKQClVNv2EW0D5TrsD1VU4SV7cHfEdCXcZue64mIs x7oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=knfgDER3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w11si5319245edb.418.2019.05.19.13.53.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 19 May 2019 13:53:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=knfgDER3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:53320 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSo1-0007gs-Dj for patch@linaro.org; Sun, 19 May 2019 16:53:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSYz-0002tD-Ow for qemu-devel@nongnu.org; Sun, 19 May 2019 16:37:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSSYy-0003b4-JV for qemu-devel@nongnu.org; Sun, 19 May 2019 16:37:45 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:36502) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSSYy-0003aB-Cd for qemu-devel@nongnu.org; Sun, 19 May 2019 16:37:44 -0400 Received: by mail-pf1-x443.google.com with SMTP id v80so6171244pfa.3 for ; Sun, 19 May 2019 13:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JWb0gO0FR8omCjsq9CBOm7HqleJuQXyRTIuggbhXR0I=; b=knfgDER37TXLkkIf/7urgSaz0r/SfBFbkjvXw/XiP6sLx4w7eklJiFggC3UDYdDaqx tUhha63z+Hg5ScSWxjc6KAo1snLcAFEZfsx9RhgITT0zYdt6B6L55bUKfe/oxpk0YCh5 4UEyMJYIMSpSlIhzNZy2QF6HrMAfzyDWMCYbFVWkB1AMa2Eh8AkQGHAQ0pnyVVeeABki CB13GMOWkZWUZ+zWPHpe7qpBnC2H4j8QIcBoTfBOvS1QinQ3bE1LNpaDhg2eNNGYgg+D 4MxCDiaCljbi0qfnbrwygoTy1droAfjhFvlgEKtYFgOJT14E6lczRaMx/SRMOfiPkU+/ r+8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JWb0gO0FR8omCjsq9CBOm7HqleJuQXyRTIuggbhXR0I=; b=o0XgaY4O6Owu052mgraC7SvgORdcXjpuyoo/BYpFMwO4us+JRav8Q0lRxBxfYhSD7J QH1xqmb/CB3q8Pz56zwZ90txPU4cVMHF5gr2COlWqWIx4+aF5RMgm46Fhv5CYZ2dv7Z8 nYCWal1YC//pPPBQ4rkVeJSps8S6BcGh8vnKKB29qvsNA/Mqxu/I18iClm+ev7EH5ih3 qgCGA+1SCQBzTuLS8itoTlywPpmzxhvMNX5IY4QDzbd4Bzw6H4WedMIr+hu/dPgG0Fl1 vSshQ1e/GFolKuBPPtwK+1/xrv0PqIh1qIYNSwIccJjPJy0kLQbExJR1CoP2uxTYeZSE ix/A== X-Gm-Message-State: APjAAAWtXEwPnraL+053KOK5w+LxN94ZpLnC7ox9to9/XvlBXSHYS/q2 1JA8JXQBeebpR4EPkLWPnyTR6A3PEyA= X-Received: by 2002:a62:4281:: with SMTP id h1mr76213248pfd.162.1558298262235; Sun, 19 May 2019 13:37:42 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id i7sm11397448pfo.19.2019.05.19.13.37.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2019 13:37:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 13:36:21 -0700 Message-Id: <20190519203726.20729-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190519203726.20729-1-richard.henderson@linaro.org> References: <20190519203726.20729-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH v7 09/74] linux-user: Split out readv, writev X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- 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(-) -- 2.17.1 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 e6adcc351c..2297ca1760 100644 --- a/linux-user/syscall-file.inc.c +++ b/linux-user/syscall-file.inc.c @@ -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; +} diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 61cd73db26..8086626707 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -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: { diff --git a/linux-user/strace.list b/linux-user/strace.list index 2d6bfec692..c4ae70b485 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