From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] tools/libxl: Initialise both parts of ctx->sigchld_selfpipe[] to -1 Date: Mon, 18 Aug 2014 14:19:47 +0100 Message-ID: <53F1FD73.9050503@citrix.com> References: <1408366957-19860-1-git-send-email-andrew.cooper3@citrix.com> <53F1FB2D.3010407@alex.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53F1FB2D.3010407@alex.org.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Alex Bligh Cc: Xen Devel List-Id: xen-devel@lists.xenproject.org On 18/08/14 14:10, Alex Bligh wrote: > On 18/08/2014 14:02, Andrew Cooper wrote: >> Otherwise, if it is not used, libxl_ctx_free() will close fd 0. > Is there some way to work around this on the caller side > without a library change? Perhaps something that forces > sigchld_selfpipe to be opened? > > Alex It looks like a call to libxl_childproc_setmode() will properly set up both halves of ctx->sigchld_selfpipe[] The call is to do with setting up the ownership of SIGCHILD in the process, and a call to libxl_childproc_setmode(ctx, NULL, 0) should be fine if you dont plan to fork in your own code. ~Andrew > > >> Reported-by: Alex Bligh >> Signed-off-by: Andrew Cooper >> CC: Ian Campbell >> CC: Ian Jackson >> --- >> tools/libxl/libxl.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c >> index 3526539..a1e0b5e 100644 >> --- a/tools/libxl/libxl.c >> +++ b/tools/libxl/libxl.c >> @@ -71,6 +71,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version, >> ctx->childproc_user = 0; >> >> ctx->sigchld_selfpipe[0] = -1; >> + ctx->sigchld_selfpipe[1] = -1; >> libxl__ev_fd_init(&ctx->sigchld_selfpipe_efd); >> >> /* The mutex is special because we can't idempotently destroy it */ >> >