From patchwork Fri Jan 15 13:23:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 8040451 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0EE319FE73 for ; Fri, 15 Jan 2016 13:25:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3299320390 for ; Fri, 15 Jan 2016 13:25:53 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 610252045A for ; Fri, 15 Jan 2016 13:25:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aK4Lt-0004Mq-CW; Fri, 15 Jan 2016 13:23:41 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aK4Lo-00048m-Qx for xen-devel@lists.xen.org; Fri, 15 Jan 2016 13:23:36 +0000 Received: from [85.158.143.35] by server-2.bemta-4.messagelabs.com id 2D/8B-08977-8D2F8965; Fri, 15 Jan 2016 13:23:36 +0000 X-Env-Sender: prvs=815b692d9=Ian.Campbell@citrix.com X-Msg-Ref: server-4.tower-21.messagelabs.com!1452864209!10277863!4 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 50770 invoked from network); 15 Jan 2016 13:23:35 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-4.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 15 Jan 2016 13:23:35 -0000 X-IronPort-AV: E=Sophos;i="5.22,299,1449532800"; d="scan'208";a="325395815" From: Ian Campbell To: , , Date: Fri, 15 Jan 2016 13:23:01 +0000 Message-ID: <1452864188-2417-23-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452864188-2417-1-git-send-email-ian.campbell@citrix.com> References: <1452864168.32341.97.camel@citrix.com> <1452864188-2417-1-git-send-email-ian.campbell@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Ian Campbell , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [Xen-devel] [PATCH XEN v8 22/29] tools/libs/call: Describe return values and error semantics for xencall* X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, RCVD_IN_BRBL_LASTEXT, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This behaviour has been confirmed by inspection on: - Linux - NetBSD & FreeBSD (NB: hcall->retval is the hypercall return value only for values >= 0. For negative values the underlying privcmd driver translates the value from Xen to {Net,Free}BSD errno space and returns it as the result of the ioctl, which becomes ret=-1/errno=EFOO in userspace) - MiniOS (which takes care of errno in this library) Signed-off-by: Ian Campbell Acked-by: Wei Liu Acked-by: Ian Jackson Acked-by: Roger Pau Monné Cc: Roger Pau Monné --- v7: Noted NetBSD behaviour v6: New patch --- tools/libs/call/include/xencall.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/libs/call/include/xencall.h b/tools/libs/call/include/xencall.h index 0d91aa8..3f325f0 100644 --- a/tools/libs/call/include/xencall.h +++ b/tools/libs/call/include/xencall.h @@ -46,6 +46,21 @@ int xencall_close(xencall_handle *xcall); /* * Call hypercalls with varying numbers of arguments. + * + * On success the return value of the hypercall is the return value of + * the xencall function. On error these functions set errno and + * return -1. + * + * The errno values will be either: + * - The Xen hypercall error return (from xen/include/public/errno.h) + * translated into the corresponding local value for that POSIX error. + * - An errno value produced by the OS driver or the library + * implementation. Such values may be defined by POSIX or by the OS. + * + * Note that under some circumstances it will not be possible to tell + * whether an error came from Xen or from the OS/library. + * + * These functions never log. */ int xencall0(xencall_handle *xcall, unsigned int op); int xencall1(xencall_handle *xcall, unsigned int op,