From patchwork Tue Nov 27 11:10:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 10700261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46FD913BF for ; Tue, 27 Nov 2018 11:15:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF8562AD66 for ; Tue, 27 Nov 2018 11:15:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0B042AD73; Tue, 27 Nov 2018 11:15:02 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 D1A8A2AD66 for ; Tue, 27 Nov 2018 11:15:01 +0000 (UTC) Received: from localhost ([::1]:41440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRbKW-000789-Nx for patchwork-qemu-devel@patchwork.kernel.org; Tue, 27 Nov 2018 06:15:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRbHE-0003Zy-KA for qemu-devel@nongnu.org; Tue, 27 Nov 2018 06:11:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRbHB-0004vf-Ad for qemu-devel@nongnu.org; Tue, 27 Nov 2018 06:11:36 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:40947) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRbH8-0004tX-Cv for qemu-devel@nongnu.org; Tue, 27 Nov 2018 06:11:31 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181127111124euoutp01680407ac30315986931326f54aee8199~q9rY0jA9s0050900509euoutp01E for ; Tue, 27 Nov 2018 11:11:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181127111124euoutp01680407ac30315986931326f54aee8199~q9rY0jA9s0050900509euoutp01E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1543317084; bh=upD3DP832gpciamOTlt+BNACQXOA2tcDeTk/eGURqvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lq7GYUiOYeAiCdukfjKFjTqeCnfiB1HRNRLZEMtjex8ISYFJmiNj5LSOmBU7oxdf5 Yh0PZ4h0mldlqqozzPJDDu2SnA7nrPN1lucTyZMZ66WK12FRui+ET1mq6Djv5ziYrv TRvS5B+7TdKtJyVzMcCIlUl2MnYHUOp303o7wgec= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181127111124eucas1p13f112f28bb5ecaeb6f00a69a7d338200~q9rYZu66B0280002800eucas1p1e; Tue, 27 Nov 2018 11:11:24 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 9E.A9.04806.B562DFB5; Tue, 27 Nov 2018 11:11:24 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181127111123eucas1p15ecbe14062e47527e59ae7d219e3879c~q9rXni2et1032210322eucas1p1n; Tue, 27 Nov 2018 11:11:23 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181127111123eusmtrp12d521cb50929d3db6d269d4d0f12e69a~q9rXZFTTG0472404724eusmtrp1Y; Tue, 27 Nov 2018 11:11:23 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-04-5bfd265b870c Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 1A.C3.04284.B562DFB5; Tue, 27 Nov 2018 11:11:23 +0000 (GMT) Received: from imaximets.rnd.samsung.ru (unknown [106.109.129.180]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181127111121eusmtip2d9d9bdf2190b08cc06bdc14ee22358c2~q9rWK8LlU0663706637eusmtip2f; Tue, 27 Nov 2018 11:11:21 +0000 (GMT) From: Ilya Maximets To: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 27 Nov 2018 14:10:50 +0300 Message-Id: <20181127111050.18453-5-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181127111050.18453-1-i.maximets@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42LZduznOd0Ytb/RBseXM1s03Au1uNL+k93i 9NEOZosFbe2sFvu3/WO1ON67g8WBzePJtc1MHu/3XWXz6NuyijGAOYrLJiU1J7MstUjfLoEr Y/m7bywFM7kq1i+6x9rAuIa9i5GTQ0LAROLyjx9sXYxcHEICKxglrrx+xgrhfGGUePp+GZTz mVHi7IbjcC1LLt1nh0gsZ5TYsuc0M4Tzg1HiztM9LCBVbAI6EqdWH2EEsUUE3CRePDgOtoRZ YBujxJ+Vs4GKODiEBYwkdjyJB6lhEVCV+PlzHyuIzStgLfFuwU1GiG3yEqs3HGAGKecUsJHY 8lMGokRQ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zTsYL20MPsQowMGoxMO74fvv aCHWxLLiytxDjBIczEoivM7Kf6OFeFMSK6tSi/Lji0pzUosPMZoC/TCRWUo0OR8YkXkl8Yam huYWlobmxubGZhZK4rznDSqjhATSE0tSs1NTC1KLYPqYODilGhhLyhxDj4UdcbzHcWPZecVt V8QMzFcIPRRI9GznvJ0TdNr2+5stjw+8en8x2aJZs8hYp2Qf572FMytuLpPy9BTgrPn1XaCk /f6UPH0G0xV7brSarTHqtlqj/3bmq7l3/7Us3nx872npNzu7OmuCAuyNFrl2B/LHcNxr+SfZ WL73apcr0wHR26lKLMUZiYZazEXFiQB5KSi3kAIAAA== X-CMS-MailID: 20181127111123eucas1p15ecbe14062e47527e59ae7d219e3879c X-Msg-Generator: CA X-RootMTR: 20181127111123eucas1p15ecbe14062e47527e59ae7d219e3879c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181127111123eucas1p15ecbe14062e47527e59ae7d219e3879c References: <20181127111050.18453-1-i.maximets@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.11 Subject: [Qemu-devel] [PATCH 4/4] memfd: improve error messages 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: Ilya Maximets , Paolo Bonzini , Igor Mammedov , qemu-devel@nongnu.org, Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This gives more information about the failure. Additionally 'ENOSYS' returned for a non-Linux platforms instead of 'errno', which is not initilaized in this case. Signed-off-by: Ilya Maximets Reviewed-by: Marc-André Lureau --- util/memfd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util/memfd.c b/util/memfd.c index 393d23da96..00334e5b21 100644 --- a/util/memfd.c +++ b/util/memfd.c @@ -71,14 +71,18 @@ int qemu_memfd_create(const char *name, size_t size, bool hugetlb, } mfd = memfd_create(name, flags); if (mfd < 0) { + error_setg_errno(errp, errno, + "failed to create memfd with flags 0x%x", flags); goto err; } if (ftruncate(mfd, size) == -1) { + error_setg_errno(errp, errno, "failed to resize memfd to %zu", size); goto err; } if (seals && fcntl(mfd, F_ADD_SEALS, seals) == -1) { + error_setg_errno(errp, errno, "failed to add seals 0x%x", seals); goto err; } @@ -88,8 +92,9 @@ err: if (mfd >= 0) { close(mfd); } +#else + error_setg_errno(errp, ENOSYS, "failed to create memfd"); #endif - error_setg_errno(errp, errno, "failed to create memfd"); return -1; }