From patchwork Mon Oct 17 13:24:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9379301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 16FBA600CA for ; Mon, 17 Oct 2016 13:43:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08C0A2937E for ; Mon, 17 Oct 2016 13:43:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F14B929380; Mon, 17 Oct 2016 13:43:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 97AAB2937E for ; Mon, 17 Oct 2016 13:43:03 +0000 (UTC) Received: from localhost ([::1]:33147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw8By-0001R0-QP for patchwork-qemu-devel@patchwork.kernel.org; Mon, 17 Oct 2016 09:43:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw7ua-0003Gm-Oo for qemu-devel@nongnu.org; Mon, 17 Oct 2016 09:25:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bw7uZ-0003GS-Qp for qemu-devel@nongnu.org; Mon, 17 Oct 2016 09:25:04 -0400 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]:36082) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bw7uZ-0003Fm-If for qemu-devel@nongnu.org; Mon, 17 Oct 2016 09:25:03 -0400 Received: by mail-lf0-x22f.google.com with SMTP id b75so288599698lfg.3 for ; Mon, 17 Oct 2016 06:25:03 -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=hNYzVLMCBK/rXcmTm7nZjDYh63b4oAbc/Ns9ygApRbI=; b=R/+7s8gzJ1RjraXD+CaFjqrDU0DFhyMTceVAMYIpVqpX6Eb/u6j5rkes6VT13bEc0P NTwBqhMSJ7B5su6MnNX+CDb5suJFOIxAgFNfJCrdghEecMFjIwUMkiAvoz2cm0bW/4A4 XA/mIvvU1T0tOc4rpF7gXjYceaJx71ACyP/gU= 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=hNYzVLMCBK/rXcmTm7nZjDYh63b4oAbc/Ns9ygApRbI=; b=B2JW7K1cDY0uASW1scDh0e5593S5bFzvSCfMyX7Shuy6UTJZSraLcFfPeKJfv2AG7f 98xxV9ElUU8Pj0kzwKZsxKjbIpclRKax02RaxvNgsVczqBMrtfTURmiHwRMcRn4EW4z2 fs4JpidaJPMMNAPzIQlhHhT4ivP+6wJr9ujSgbC2Xo1FhO92VRF7EXfXK4paKNus7l8c cU8CWRnReiT4lgQthi5KyMSk2+TG1IlBKXYlZl05X/Te8VEUm/y3Aa6nIeKm/4kVz+uw 61eGpu8kJ2wUh+4DcqnN1DfovasEpFnOCAVw3NvYj+3WyMgB/avWM2voLeAp6utFBY2I acLg== X-Gm-Message-State: AA6/9Rm947am1574Vg4/H9D/qxr29/jX1ui6xVOdy/PYMpaF/YLWXTvMQ9svqBxIci5loXK8 X-Received: by 10.25.66.72 with SMTP id p69mr14731727lfa.82.1476710702174; Mon, 17 Oct 2016 06:25:02 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id y81sm7782857lff.29.2016.10.17.06.25.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Oct 2016 06:25:01 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 17 Oct 2016 16:24:33 +0300 Message-Id: <65c7e9b5015cc285bd6fa62543ce4238c40ac84d.1476710353.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::22f Subject: [Qemu-devel] [PULL 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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 13513af..a91383f 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;