Get an X window ID

Daniel Stone daniel at fooishbar.org
Thu May 17 10:16:53 PDT 2007


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.  I believe the server can
already get the PID of a client via getpeerucred() or similar.

Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20070517/a923f737/attachment.pgp>


More information about the xorg mailing list