From patchwork Sun Jun 10 03:02:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138174 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2613964lji; Sat, 9 Jun 2018 21:14:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJU784QSqipXkaZHJdubEnqNQyMSyET3wzGwqoSLaQ16Om6aMj6nnFphcl3zN0GkCiCXF8f X-Received: by 2002:ac8:1090:: with SMTP id a16-v6mr3161184qtj.307.1528604067338; Sat, 09 Jun 2018 21:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528604067; cv=none; d=google.com; s=arc-20160816; b=wJKVAa7+/v7m8LXLq4IHw4Jis8SpZG+7AxvNHco2w+fhuGgZGzyDdO0E1Pedh4HgoX mFZ/613aP9kUHxM3AGAr+9QyMz2tPdURPGEd1DnxX3gMktY+ukXCIhTj0IF4aI72AqqZ KUATWGzoFxMTh+/y3viTUV0f5zSUFND4ic8fCpA/iPvXwmbautGLAa3lhs6sZNGeJFoZ Ow2LbxGDb68KGbgZojZelySUfFyYI29SkfwQvKz8PUFz1Zv6OZ7Yl6tc1VMQt0ZTAjQu 4U3/eavy/pggj/OTxF9CS/cVs7b6RRTeeuL01dVFu3Ikuc0Ky7mbJxzC2wK0VeRwYuro N16g== 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:arc-authentication-results; bh=Q3hyNEKTYkeV+S5YR7K8UJIocovN8V+pUIR4pcFGMyQ=; b=pcRl7J1MUkBRDWlu5dTYbOFMuxLfWfgFy6WmbfUX8MUmLP0KSlYXdwCECnS/s2rnJP p04qZ7e4dSulWoksXXp5FYln9UzOSjdXsWHu3b2x7ZeUn2a1/NNKTBx+ED3GEmDmcxlG nTdy3QNr17WqoIr6m8pHWI9xUrkteyYgobdD47/ISIkwrcdyDFieTttUAPoCVC6WlMaK RWauKl1MnXWViKb6660r+6n02Xd1PiV2xtr1M81ccKeKSkh3pj4EpgzwU1ghJwmM8RnT eX5nV4pu6J+WoLEpK9jvdLhi5vv5rJQlLPB9cV9Jkbk8xw6wlAE9gc+gOUISHpRoyFbr xjLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=N+hKJ6Eg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u21-v6si8602119qvc.168.2018.06.09.21.14.27 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 21:14:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=N+hKJ6Eg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:42575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrkI-0008Da-OE for patch@linaro.org; Sun, 10 Jun 2018 00:14:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqfp-0004UN-MA for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqfo-0004hw-Lm for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:45 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:40580) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqfo-0004hh-DE for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:44 -0400 Received: by mail-pf0-x241.google.com with SMTP id z24-v6so8491736pfe.7 for ; Sat, 09 Jun 2018 20:05: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=Q3hyNEKTYkeV+S5YR7K8UJIocovN8V+pUIR4pcFGMyQ=; b=N+hKJ6Egc/yxBRwMM7ZRomqksFJpij04D/WA2GRewN6M9hi4jotyYCtYPV8YLDQ/Rt wTmgk11QlaAJj8cD+eZNmdxqfi55dNc/7o2tM+rl49OjUEzeS5zB9GUINNH9iNbIh5LJ YkGwUt34zqI5Xr8cAzkLKrHYy5Y+2ewGI2mWA= 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=Q3hyNEKTYkeV+S5YR7K8UJIocovN8V+pUIR4pcFGMyQ=; b=SKulJqtAFJCdrpjneYS7JHd87H/9PNJFBiLQznrUl/0mssq8DuY9cQFm29kboGIHQJ PyIMGsg/3xaAWOivZOSm1xrLiGsta1smKor+QKd+dnQLCVXrd+mGSrKoslmr10FwCpx3 nmElgobqCyJLIRDDLNMzLEDLobn3To/KbP21FRhM6FwcZhkUQy0YyCq60ypRMysWexbz tOsSIbj5H5gzET1F4fHmWRJdrsrtuqeOqyRrpSOIqyqMqPGvRHhtyUN/TdGmOQZ8IFMw ArQLUdz0t/abGvzj7kmmZdineMqcMBfLxmfDuMD17lmcA8uwRnjnAknUh5r0H+BkcHep jq4w== X-Gm-Message-State: APt69E3QvtfjTkFg7cawVbjfAxHBAktC4jAbrnK/Fdo0JfQ94P1DKw54 2xKwDo4LvlNhXl9tOE+v0WAJS71/Xnk= X-Received: by 2002:a62:3b5d:: with SMTP id i90-v6mr12354873pfa.24.1528599943165; Sat, 09 Jun 2018 20:05:43 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id y17-v6sm31712718pfe.33.2018.06.09.20.05.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:05:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:02:08 -1000 Message-Id: <20180610030220.3777-97-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180610030220.3777-1-richard.henderson@linaro.org> References: <20180610030220.3777-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PATCH v2 096/108] linux-user: Split out splice, tee, vmsplice 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" All targets define all of these; remove the ifdefs. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 117 +++++++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 53 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 0c312cd156..8548f113d1 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -12075,6 +12075,39 @@ IMPL(socketpair) } #endif +#ifdef CONFIG_SPLICE +IMPL(splice) +{ + loff_t loff_in, loff_out; + loff_t *ploff_in = NULL, *ploff_out = NULL; + abi_long ret; + + if (arg2) { + if (get_user_u64(loff_in, arg2)) { + return -TARGET_EFAULT; + } + ploff_in = &loff_in; + } + if (arg4) { + if (get_user_u64(loff_out, arg4)) { + return -TARGET_EFAULT; + } + ploff_out = &loff_out; + } + ret = get_errno(splice(arg1, ploff_in, arg3, ploff_out, arg5, arg6)); + if (arg2) { + if (put_user_u64(loff_in, arg2)) { + return -TARGET_EFAULT; + } + } + if (arg4) { + if (put_user_u64(loff_out, arg4)) { + return -TARGET_EFAULT; + } + } + return ret; +} +#endif #ifdef TARGET_NR_ssetmask IMPL(ssetmask) { @@ -12324,6 +12357,13 @@ IMPL(syslog) } } +#ifdef CONFIG_SPLICE +IMPL(tee) +{ + return get_errno(tee(arg1, arg2, arg3, arg4)); +} +#endif + IMPL(tgkill) { return get_errno(safe_tgkill((int)arg1, (int)arg2, @@ -12603,6 +12643,21 @@ IMPL(vm86) } #endif +#ifdef CONFIG_SPLICE +IMPL(vmsplice) +{ + struct iovec *vec = lock_iovec(VERIFY_READ, arg2, arg3, 1); + abi_long ret; + + if (vec == NULL) { + return -host_to_target_errno(errno); + } + ret = get_errno(vmsplice(arg1, vec, arg3, arg4)); + unlock_iovec(vec, arg2, arg3, 0); + return ret; +} +#endif + IMPL(wait4) { int status; @@ -12712,59 +12767,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, abi_long ret; switch(num) { -#ifdef CONFIG_SPLICE -#ifdef TARGET_NR_tee - case TARGET_NR_tee: - { - ret = get_errno(tee(arg1,arg2,arg3,arg4)); - } - return ret; -#endif -#ifdef TARGET_NR_splice - case TARGET_NR_splice: - { - loff_t loff_in, loff_out; - loff_t *ploff_in = NULL, *ploff_out = NULL; - if (arg2) { - if (get_user_u64(loff_in, arg2)) { - return -TARGET_EFAULT; - } - ploff_in = &loff_in; - } - if (arg4) { - if (get_user_u64(loff_out, arg4)) { - return -TARGET_EFAULT; - } - ploff_out = &loff_out; - } - ret = get_errno(splice(arg1, ploff_in, arg3, ploff_out, arg5, arg6)); - if (arg2) { - if (put_user_u64(loff_in, arg2)) { - return -TARGET_EFAULT; - } - } - if (arg4) { - if (put_user_u64(loff_out, arg4)) { - return -TARGET_EFAULT; - } - } - } - return ret; -#endif -#ifdef TARGET_NR_vmsplice - case TARGET_NR_vmsplice: - { - struct iovec *vec = lock_iovec(VERIFY_READ, arg2, arg3, 1); - if (vec != NULL) { - ret = get_errno(vmsplice(arg1, vec, arg3, arg4)); - unlock_iovec(vec, arg2, arg3, 0); - } else { - ret = -host_to_target_errno(errno); - } - } - return ret; -#endif -#endif /* CONFIG_SPLICE */ #ifdef CONFIG_EVENTFD #if defined(TARGET_NR_eventfd) case TARGET_NR_eventfd: @@ -13800,6 +13802,9 @@ static impl_fn *syscall_table(unsigned num) #ifdef TARGET_NR_socketpair SYSCALL(socketpair); #endif +#ifdef CONFIG_SPLICE + SYSCALL(splice); +#endif #ifdef TARGET_NR_ssetmask SYSCALL(ssetmask); #endif @@ -13831,6 +13836,9 @@ static impl_fn *syscall_table(unsigned num) #endif SYSCALL(sysinfo); SYSCALL(syslog); +#ifdef CONFIG_SPLICE + SYSCALL(tee); +#endif SYSCALL(tgkill); #ifdef TARGET_NR_time SYSCALL(time); @@ -13867,6 +13875,9 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(vhangup); #if defined(TARGET_I386) && !defined(TARGET_X86_64) SYSCALL(vm86); +#endif +#ifdef CONFIG_SPLICE + SYSCALL(vmsplice); #endif SYSCALL(wait4); SYSCALL(waitid);