[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tools/libxl: Initialise both parts of ctx->sigchld_selfpipe[] to -1



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@xxxxxxxxxxx>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
>> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
>> ---
>>  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 */
>>
>


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.