display using unix-domain socket (was Re: fd passing for X)

Antoine Martin antoine at nagafix.co.uk
Sat Oct 6 03:32:59 PDT 2012


On 10/06/2012 05:15 PM, Michal Suchanek wrote:
> On 6 October 2012 12:02, Antoine Martin <antoine at nagafix.co.uk> wrote:
>> On 10/06/2012 04:56 PM, Michal Suchanek wrote:
>>> Hello,
>>>
>>> What's the advantage of that patch?
>> 1) You can use a socket path you create in advance, so you know for
>> certain that it is free when you call the server.
>> You then know for certain that this is what will be used by the server,
>> not some free port you have no way of guessing correctly.
> 
> There is an option for the X server to print the display name from
> which it should be possible to infer the display port.
Since I want to chose the *unix-domain-socket* that will be used, this
feature is not useful. Or are you advocating that the X11 server should
chose the unix-domain socket path to use itself? Seriously? Now, that
would be a lot more complicated, and I don't see any real benefits either.

> If the user is choosing a port or file path the user then needs to go
> through the dances of determining which port or path is still
> available for starting a new X server. This is just moved from the X
> server to user.
Important note: no ports are involved here, just paths.
There is a point in letting the X11 server do this allocation for TCP
ports (no changes here), which are in limited supply and need to be
allocated atomically, but none of this applies to unix domain sockets.

>> 2) That socket path can be totally private, using a file path with very
>> restrictive permissions if you wish to do so.
> 
> That's definitely an advantage.
> 
>>
>>> As far as I understand the patch shifts the burden of finding a free
>>> port (or socket path) from the X server to the user.
>> Yes, it does. If by burden you mean freedom.
> 
> You have to somehow determine if the path you picked is free or in use
> by earlier X server or another program.
> Think about two scripts trying to start an X server at the same time, etc.
ie:
SOCKET=`mktemp -d`/X11-socket
Not hard, is it? No parsing the output, no "go throught the dances of
determining which (..) path is still available..."

Antoine

> For display ports the X server does this for you and outputs the port
> number when allocated if asked to.
> 
> Thanks
> 
> Michal



More information about the xorg-devel mailing list