[Xcb] [PATCH] Open the X11 socket with close-on-exec flag

Jamey Sharp jamey at minilop.net
Mon Feb 15 16:05:37 PST 2010


2010/2/15 Barton C Massey <bart at cs.pdx.edu>:
> In message <87y6iv2bdx.fsf at vertex.dottedmag> you wrote:
>>  BCM> Some reason why the child doesn't just close the connection?
>>
>> Child has literally no idea that the connection is there.
>
> I'm not getting it?  The child is a fork of the parent; the
> parent presumably knew the connection was there, since it
> presumably opened it.

It's a modularity issue. One component opened the X connection;
another called fork(), usually promptly followed by exec(). Then the
child has lost any record that it's sharing an FD with the parent,
unless it goes probing the kernel's FD table.

I can't say I care very much about the race condition here between
creating the socket and marking it close-on-exec, since it primarily
applies if one thread is connecting to an X server concurrently with
another thread calling fork, but I guess I'm not opposed to narrowing
it.

Jamey


More information about the Xcb mailing list