From patchwork Tue Oct 18 13:21:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 78042 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp886281qge; Tue, 18 Oct 2016 06:30:08 -0700 (PDT) X-Received: by 10.55.129.1 with SMTP id c1mr475933qkd.53.1476797408953; Tue, 18 Oct 2016 06:30:08 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 8si20984725qkq.98.2016.10.18.06.30.08 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 18 Oct 2016 06:30:08 -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; 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 dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwUT2-0003p4-BP for patch@linaro.org; Tue, 18 Oct 2016 09:30:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwULN-0006NM-KB for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwULM-0000jS-98 for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:13 -0400 Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]:33870) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwULL-0000ho-VI for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:12 -0400 Received: by mail-lf0-x232.google.com with SMTP id b81so343454147lfe.1 for ; Tue, 18 Oct 2016 06:22:11 -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=WyIXVzfD/gwwNLiJvKNNNMcocL4SOH1Bcik0QWGFe88=; b=OTodBMu9Wgw+gj0m/hxvbRLOdYWRPyARlb3lVph7PiM6+m4VA/eI1sh9JfV4dXwaXZ ar0/qV2a8fOWTh8WtOJalJnbjZFUuZTzGDyElwXZ2Ti0wYxcxU2q2Kd28UN5agL/rHYt BpCGYNZO0eDMg41PtzZipbFZ1PXReXQtSW0iI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WyIXVzfD/gwwNLiJvKNNNMcocL4SOH1Bcik0QWGFe88=; b=KgsX7mNT/2v9LhUEi3ecMFdp/x2VkbtF2KWA6e4d3GACcbUUAQCrDGrvWmwLkuGoDY UziID0F1VxcG0XruIlo9SXK6uba7DYJuKARbcCQMTE4tg330fMmRVldk6O6NncCDwQ4s YpowBqpOMDA4EqbPTDVtOk3AJHv2nNt74KARGXKBCzZe4G1qZl7H7aI5ObrESAvquVGY /1Yxh3cR4TojyEQaAyun3Re88bRDRbiLdkV4v/5eb+Bc4+tvwoCr5I/nEw5j8vD/TssZ 6Ot99+BxSileTAaIlQ9RjPNCrU3ENRaksktu0MzTkgfTU1ij2dEy52hOg1a7PHYUK8af aZUA== X-Gm-Message-State: AA6/9RmribGQhQ6aOBbKwpOtqPM8ESgF8s0osyQtfRvZDsBj7h+ek8J6BRDgp+y6JFa7mBcC X-Received: by 10.25.74.143 with SMTP id x137mr588014lfa.10.1476796929896; Tue, 18 Oct 2016 06:22:09 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 201sm9535359ljf.48.2016.10.18.06.22.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Oct 2016 06:22:09 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 18 Oct 2016 16:21:43 +0300 Message-Id: <2130e4a18f76ae5bbf6836b6f6c2f40e8cc51437.1476796525.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::232 Subject: [Qemu-devel] [PULL v2 15/22] linux-user: Add support for syncfs() syscall 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: Peter Maydell , Aleksandar Markovic Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Aleksandar Markovic This patch implements Qemu user mode syncfs() syscall support. Syscall syncfs() syncs the filesystem containing file determined by the open file descriptor passed as the argument to syncfs(). The implementation consists of a straightforward invocation of host's syncfs(). Configure and strace support is included as well. Signed-off-by: Aleksandar Markovic Signed-off-by: Riku Voipio --- configure | 18 ++++++++++++++++++ linux-user/strace.list | 2 +- linux-user/syscall.c | 5 +++++ 3 files changed, 24 insertions(+), 1 deletion(-) -- 2.1.4 diff --git a/configure b/configure index 1ce3d00..d3dafcb 100755 --- a/configure +++ b/configure @@ -3926,6 +3926,21 @@ if compile_prog "" "" ; then clock_adjtime=yes fi +# syncfs probe +syncfs=no +cat > $TMPC < + +int main(void) +{ + return syncfs(0); +} +EOF +syncfs=no +if compile_prog "" "" ; then + syncfs=yes +fi + # Check if tools are available to build documentation. if test "$docs" != "no" ; then if has makeinfo && has pod2man; then @@ -5214,6 +5229,9 @@ fi if test "$clock_adjtime" = "yes" ; then echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak fi +if test "$syncfs" = "yes" ; then + echo "CONFIG_SYNCFS=y" >> $config_host_mak +fi if test "$inotify" = "yes" ; then echo "CONFIG_INOTIFY=y" >> $config_host_mak fi diff --git a/linux-user/strace.list b/linux-user/strace.list index dcd3812..3b1282e 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1459,7 +1459,7 @@ { TARGET_NR_sync, "sync" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_syncfs -{ TARGET_NR_syncfs, "syncfs" , NULL, NULL, NULL }, +{ TARGET_NR_syncfs, "syncfs" , "%s(%d)", NULL, NULL }, #endif #ifdef TARGET_NR_syscall { TARGET_NR_syscall, "syscall" , NULL, NULL, NULL }, diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 28d2b8e..d85a0b5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8091,6 +8091,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, sync(); ret = 0; break; +#if defined(TARGET_NR_syncfs) && defined(CONFIG_SYNCFS) + case TARGET_NR_syncfs: + ret = get_errno(syncfs(arg1)); + break; +#endif case TARGET_NR_kill: ret = get_errno(safe_kill(arg1, target_to_host_signal(arg2))); break;