From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Stekloff Subject: RE: DOM0_GETDOMAININFO intended behavior Date: Mon, 06 Jun 2005 15:28:22 -0700 Message-ID: <1118096902.5094.26.camel@w-stekloff.beaverton.ibm.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-JOqBMygiRVlT47S1ZsoP" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Pratt Cc: Kip Macy , xen-devel@lists.xensource.com, Christian.Limpach@cl.cam.ac.uk List-Id: xen-devel@lists.xenproject.org --=-JOqBMygiRVlT47S1ZsoP Content-Type: text/plain Content-Transfer-Encoding: 7bit On Sat, 2005-06-04 at 22:51 +0100, Ian Pratt wrote: > > You're right, it isn't difficult to check what is returned - > > provided you know what to expect. If you're new, however, to > > the API and unfamiliar with the fact that it returns the next > > domain in the line, you could hit what we just hit. We built > > an application to use the interface and our tests returned > > some odd behavior. We had to delve deeper to find out if this > > was correct or not. > > You're not the first person to be caught out by this -- I seem to recall > that xenctx forgets to do the domid check too. > > Passing a flag in to explicitly request that you want to iterate would > probably be an improvement to the interface. Instead of changing the interface and the applications, how about the following: If you request a specific domain id and it doesn't exist, you get back the expected result. If, however, you want a list of domains it works like it has been. Thanks, Dan Signed-off-by: dsteklof@us.ibm.com --=-JOqBMygiRVlT47S1ZsoP Content-Disposition: attachment; filename=xc_domain_getinfo.patch Content-Type: text/x-patch; name=xc_domain_getinfo.patch; charset=utf-8 Content-Transfer-Encoding: 7bit --- xeno-unstable-latest/tools/libxc/xc_domain.c 2005-06-06 11:53:03.000000000 -0700 +++ xeno-unstable/tools/libxc/xc_domain.c 2005-06-06 15:28:59.000000000 -0700 @@ -83,6 +83,11 @@ op.u.getdomaininfo.domain = (domid_t)next_domid; if ( (rc = do_dom0_op(xc_handle, &op)) < 0 ) break; + if ( max_doms == 1 && op.u.getdomaininfo.domain != first_domid ) + { + rc = -ESRCH; + break; + } info->domid = (u16)op.u.getdomaininfo.domain; info->dying = !!(op.u.getdomaininfo.flags & DOMFLAGS_DYING); --=-JOqBMygiRVlT47S1ZsoP Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-JOqBMygiRVlT47S1ZsoP--