From: Ian Campbell Subject: Re: [RFC Patch v4 7/9] correct xc_domain_save()'s return value Date: Mon, 22 Sep 2014 13:42:56 +0100 Message-ID: <1411389776.18331.73.camel@kazak.uk.xensource.com> References: <1411365561-29242-1-git-send-email-wency@cn.fujitsu.com> <1411365561-29242-8-git-send-email-wency@cn.fujitsu.com> <20140922073053.GA6584@aepfle.de> <541FD0F4.8080400@cn.fujitsu.com> <20140922074625.GA9788@aepfle.de> <541FD88B.5080209@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <541FD88B.5080209@cn.fujitsu.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: Wen Congyang Cc: Olaf Hering , Lai Jiangshan , Ian Jackson , Jiang Yunhong , Dong Eddie , xen devel , Yang Hongyang List-Id: xen-devel@lists.xenproject.org On Mon, 2014-09-22 at 16:06 +0800, Wen Congyang wrote: > On 09/22/2014 03:46 PM, Olaf Hering wrote: > > On Mon, Sep 22, Wen Congyang wrote: > > > >> On 09/22/2014 03:30 PM, Olaf Hering wrote: > >>> On Mon, Sep 22, Wen Congyang wrote: > >>> > >>>> if ( !(*suspend)(data) ) > >>>> { > >>>> ERROR("Suspend request failed"); > >>>> + errno = errno ? : -1; > >>> > >>> -1 is not a valid value for errno, it should be ESOMETHING. > >> > >> But, we don't know what's wrong, so I don't know which ESOMETHING is > >> OK here... > > > > The called function has to set errno. If it doesnt do that today, fix > > the callbacks. > > The callbacks may be implemented in libxl, which is another process. libxc doesn't know that, if it is important then it seems like the failure + errno ought to be marshalled across the IPC link. It may be that this can be easily handled in libxl__srm_callout_sendreply + helper_getreply. Ian J -- what do you think? > xc_domain_save() is a public API, and the caller may forget to set > the errno... > > So we cannot assume that the callbacks has set the errno I think we are entitled to assume that they must (iff returning -1) Ian.