From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: Re: [PATCH XEN v6 27/32] tools/libs/call: Describe return values and error semantics for xencall* Date: Wed, 9 Dec 2015 12:22:48 +0000 Message-ID: <20151209122248.GJ23818@citrix.com> References: <1449141675.4424.125.camel@citrix.com> <1449141749-14940-1-git-send-email-ian.campbell@citrix.com> <1449141749-14940-28-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <1449141749-14940-28-git-send-email-ian.campbell@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: wei.liu2@citrix.com, Roger Pau =?iso-8859-1?Q?Monn=E9?= , ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, Dec 03, 2015 at 11:22:24AM +0000, Ian Campbell wrote: > This behaviour has been confirmed by inspection on: > = > - Linux > - FreeBSD (NB: hcall->retval is the hypercall return value only for > values >=3D 0. For negative values the underlying privcmd driver > translates the value from Xen to FreeBSD errno space and returns it as > the result of the ioctl, which becomes ret=3D-1/errno=3DEFOO in usersp= ace) > - MiniOS (which takes care of errno in this library) > = It's worth noting that NetBSD also has similar behaviour -- it's privcmd driver translates errno. http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/xen/xen/privcmd.c?rev=3D1.= 49&content-type=3Dtext/x-cvsweb-markup Acked-by: Wei Liu > Signed-off-by: Ian Campbell > Cc: Roger Pau Monn=E9 > --- > 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, > -- = > 2.1.4 > =