From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH RFC 03/14] libxc: Fix xc_domain_get_tsc_info returning -Exx instead of -1. Date: Sat, 14 Mar 2015 07:55:39 +0000 Message-ID: <1426319739.28029.49.camel@citrix.com> References: <1426275083-8454-1-git-send-email-konrad.wilk@oracle.com> <1426275083-8454-4-git-send-email-konrad.wilk@oracle.com> <20150313194032.GA9130@l.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YWgvA-0007Yz-9y for xen-devel@lists.xenproject.org; Sat, 14 Mar 2015 07:55:45 +0000 In-Reply-To: <20150313194032.GA9130@l.oracle.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: Konrad Rzeszutek Wilk Cc: xen-devel@lists.xenproject.org, ian.jackson@eu.citrix.com, wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Fri, 2015-03-13 at 15:40 -0400, Konrad Rzeszutek Wilk wrote: > On Fri, Mar 13, 2015 at 03:31:12PM -0400, Konrad Rzeszutek Wilk wrote: > > Instead put the -Exx in errno. > > > > Signed-off-by: Konrad Rzeszutek Wilk > > --- > > tools/libxc/xc_domain.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c > > index 845d1d7..eb3a5f2 100644 > > --- a/tools/libxc/xc_domain.c > > +++ b/tools/libxc/xc_domain.c > > @@ -771,8 +771,10 @@ int xc_domain_get_tsc_info(xc_interface *xch, > > > > info = xc_hypercall_buffer_alloc(xch, info, sizeof(*info)); > > if ( info == NULL ) > > - return -ENOMEM; > > - > > + { > > + errno = ENOMEM; > > + return -1; > > + } > > While I was doing that I saw a lot of other code doing: > > > if ( xc_hypercall_bounce_pre (..) ) > return -1; > > Should they all be fixed up to do: > 'errno = ENOMEM' > > before returning -1? I think xc_hypercall_bounce_pre should probably set an appropriate errno on failure rather than making all the callers have to think about it. It may indirectly already do so via mmap? I didn't actually go look... Ian.