All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Alex Bligh <alex@alex.org.uk>
Cc: Xen Devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] tools/libxl: Initialise both parts of ctx->sigchld_selfpipe[] to -1
Date: Mon, 18 Aug 2014 14:19:47 +0100	[thread overview]
Message-ID: <53F1FD73.9050503@citrix.com> (raw)
In-Reply-To: <53F1FB2D.3010407@alex.org.uk>

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 <alex@alex.org.uk>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> CC: Ian Campbell <Ian.Campbell@citrix.com>
>> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
>> ---
>>  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 */
>>
>

  reply	other threads:[~2014-08-18 13:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 13:02 [PATCH] tools/libxl: Initialise both parts of ctx->sigchld_selfpipe[] to -1 Andrew Cooper
2014-08-18 13:10 ` Alex Bligh
2014-08-18 13:19   ` Andrew Cooper [this message]
2014-08-18 14:18     ` Alex Bligh
2014-08-26 23:34 ` Andrew Cooper
2014-08-27  1:55 ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53F1FD73.9050503@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=alex@alex.org.uk \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.