[Xcb] [PATCH] Open the X11 socket with close-on-exec flag
Rémi Denis-Courmont
remi at remlab.net
Mon Feb 15 23:54:58 PST 2010
On Mon, 15 Feb 2010 15:13:33 -0800, Barton C Massey <bart at cs.pdx.edu>
wrote:
> 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.
>
> Is this just about making popen() work better?
popen(), system() or the more recent posix_spawn*(). But even if you do
plain fork-and-exec, you might not know which file descriptors to close and
which not to. This is especially true with multi-thread and/or with
plugins.
Anyway, libxcb is already marking the file for close-on-exec. The only
thing this patch really changes is the addition of thread-safety on Linux.
(Hopefully will be available in a later POSIX release, but I wouldn't hold
my breath at this point)
--
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis
More information about the Xcb
mailing list