From nobody Thu May 2 13:32:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1517831100237863.0275896951104; Mon, 5 Feb 2018 03:45:00 -0800 (PST) Received: from localhost ([::1]:59988 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eifCl-00015P-CS for importer@patchew.org; Mon, 05 Feb 2018 06:44:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eifBH-0000AL-FR for qemu-devel@nongnu.org; Mon, 05 Feb 2018 06:43:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eifBC-00031U-KY for qemu-devel@nongnu.org; Mon, 05 Feb 2018 06:43:27 -0500 Received: from mx2.suse.de ([195.135.220.15]:39161) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eifBC-00030x-DK for qemu-devel@nongnu.org; Mon, 05 Feb 2018 06:43:22 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 46511ACED for ; Mon, 5 Feb 2018 11:43:21 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Andreas Schwab To: qemu-devel@nongnu.org X-Yow: I hope I bought the right relish... zzzzzzzzz... Date: Mon, 05 Feb 2018 12:43:20 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 195.135.220.15 Subject: [Qemu-devel] [PATCH] linux-user: Implement copy_file_range 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" No attempt is made to emulate it on the host. Signed-off-by: Andreas Schwab --- linux-user/syscall.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 07fb8de921..ff89016adc 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1033,6 +1033,12 @@ safe_syscall5(int, mq_timedsend, int, mqdes, const c= har *, msg_ptr, safe_syscall5(int, mq_timedreceive, int, mqdes, char *, msg_ptr, size_t, len, unsigned *, prio, const struct timespec *, time= out) #endif +#if defined(TARGET_NR_copy_file_range) && defined(__NR_copy_file_range) +safe_syscall6(ssize_t, copy_file_range, int, infd, loff_t *, pinoff, + int, outfd, loff_t *, poutoff, size_t, length, + unsigned int, flags) +#endif + /* We do ioctl like this rather than via safe_syscall3 to preserve the * "third argument might be integer or pointer or not present" behaviour of * the libc function. @@ -12578,6 +12584,39 @@ abi_long do_syscall(void *cpu_env, int num, abi_lo= ng arg1, ret =3D get_errno(kcmp(arg1, arg2, arg3, arg4, arg5)); break; #endif +#if defined(TARGET_NR_copy_file_range) && defined(__NR_copy_file_range) + case TARGET_NR_copy_file_range: + { + loff_t inoff, outoff; + loff_t *pinoff =3D NULL, *poutoff =3D NULL; + + if (arg2) { + if (get_user_u64(inoff, arg2)) { + goto efault; + } + pinoff =3D &inoff; + } + if (arg4) { + if (get_user_u64(outoff, arg4)) { + goto efault; + } + poutoff =3D &outoff; + } + ret =3D get_errno (safe_copy_file_range (arg1, pinoff, arg3, p= outoff, + arg5, arg6)); + if (arg2) { + if (put_user_u64(inoff, arg2)) { + goto efault; + } + } + if (arg4) { + if (put_user_u64(outoff, arg4)) { + goto efault; + } + } + } + break; +#endif =20 default: unimplemented: --=20 2.16.1 --=20 Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint =3D 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."