X startup and authorization

tom fogal tfogal at alumni.unh.edu
Mon May 24 17:51:34 PDT 2010


We've got a parallel application which can start up some X servers and
use them as a `render farm' in some sense.  I'm looking for some advice
on how I can improve the existing setup.

The first issue is startup: we fork and then exec `xinit' in the child;
the parent sets the appropriate DISPLAY and renders into it.  The
issue we have is that the parent does not know when the X server is
"ready" for rendering.  Our current "solution" is to sleep a bit, which
obviously isn't great.  How can I tell when a server has initialized?
Ideally I would like to know if/when it failed to initialize, and pull
out some sort of error message so that I could report it back to the
user.

The second is authorization.  I'll admit to not understanding this
thoroughly.  It sounds like I want to create an MIT-MAGIC-COOKIE-1,
tell the X server about it when I start (how?), and then shove it in a
file which I point to using the XAUTHORITY environment var.  Does that
sound like the best approach in terms of portability?  Ideally whatever
I implement would work with some pretty old X servers (5 years or so).

Also on the topic of authorization -- where is the API for this?
`xhost' and `xauth' must be using Xlib functions to do their magic,
right?  I'd really like to avoid having to system() or fork/exec to do
proper authorization.

-tom



More information about the xorg mailing list