Get an X window ID

Eamon Walsh ewalsh at tycho.nsa.gov
Thu May 17 14:55:42 PDT 2007


Alan Coopersmith wrote:
> Daniel Stone wrote:
>> On Thu, May 17, 2007 at 11:00:33AM -0500, Pat Kane wrote:
>>> Are you allowed to change Xlib and the X server?
>>>
>>> If so then this hack might help.
>>>
>>> A while ago I needed to know, from inside the X server,
>>> the PID of a process that created an X connection.
>>>
>>> I used spare pad bytes in the  xConnClientPrefix initial
>>> connection setup message to pass the PID from the client
>>> to the X server.  Note that clients might not be on the
>>> same machine so you also need the hostname of the client.
>> NetWM already allows you to use properties to encode the pid and
>> hostname of clients as window properties.
> 
> Should we have Xlib or xcb automatically set these so that
> we don't have to wait for every application and toolkit to
> be modified to do so?
> 

As long as it's clear that they can be misrepresented by the client.

The server could check the values with getpeerucred or whatever.  But 
that's not always possible.



-- 
Eamon Walsh <ewalsh at tycho.nsa.gov>
National Security Agency



More information about the xorg mailing list