From: Ian Jackson Subject: RE: [PATCH V4] libxl: make libxl communicate with xenstored by socket or xenbus driver Date: Fri, 17 Sep 2010 16:06:13 +0100 Message-ID: <19603.33765.15374.821794@mariner.uk.xensource.com> References: <433DDF91DFB08148BAD3FDB6FDDA314C9F35F3BB6A@LONPMAILBOX01.citrite.net> <19599.41566.729352.138960@mariner.uk.xensource.com> <1284540109.14311.18387.camel@zakaz.uk.xensource.com> <19602.18229.95233.935776@mariner.uk.xensource.com> <433DDF91DFB08148BAD3FDB6FDDA314C9F35F3BB6F@LONPMAILBOX01.citrite.net> <1284712745.16095.3048.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1284712745.16095.3048.camel@zakaz.uk.xensource.com> 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 Campbell Cc: "Jun Zhu (Intern)" , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("RE: [Xen-devel] [PATCH V4] libxl: make libxl communicate with xenstored by socket or xenbus driver"): > On Thu, 2010-09-16 at 20:21 +0100, Jun Zhu (Intern) wrote: > > The functions, such as dm_xenstore_record_pid, do not have a ctx > > pointer in its function parameters. In these functions, if they invoke > > the libxl__xs_open, it does not have ctx pointer. Should we use the > > extern ctx directly? I find only the functions in xl_cmdimpl.c use ctx > > in this way, and the other functions under libxl get the ctx pointer > > from its function parameter. > > Under no circumstances should libxl try and use a global ctx pointer > from the application using libxl. > > dm_xenstore_record_pid runs in a new process and therefore there is no > existing context which can be used. I think it is fine to to reuse the ctx from the caller in dm_xenstore_record_pid. Your "new process" test seems to imply problems for any other daemonic processes libxl may need to spawn. If the caller needs to know when libxl forks, we should provide a callback function pointer in the ctx to allow the caller to be told. Ian.