[prev in list] [next in list] [prev in thread] [next in thread]
List: freedesktop-xorg
Subject: Re: X startup and authorization
From: tom fogal <tfogal () alumni ! unh ! edu>
Date: 2010-05-25 22:48:13
Message-ID: auto-000022777969 () sci ! utah ! edu
[Download RAW message or body]
Hi Alan, thanks for your reply. I hit a snag + worked around it, and
so I wanted to report back to the list for posterity.
Comments/suggestions of course still welcome.
Alan Coopersmith <alan.coopersmith@oracle.com> writes:
> tom fogal wrote:
> > 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?
>
> The xserver notifies its parent - xinit/xdm/etc. - via a signal, at
> which point they start clients - presumably you'd put something in
> the .xinitrc to in turn signal your parent process that called xinit.
>
> You could of course take xinit out of the middle and exec the X
> server from your software so it gets the signal or error return
> directly - you can see from the source it's not that complicated.
FWIW, I gave this a try, and spent a while banging my head against the
desk trying to figure out what was wrong. It seems like my distro
inserts an extra layer -- Xwrapper.config(5) -- which comes between
/usr/bin/X and actually getting an X server. I imagine this wrapper
was the one getting the signal, because my code would always lock up at
the sigsuspend and just wait forever.
*sigh*. I imagine other distros do something similar, and I of course
don't want it to be "broken by default" from a user's point of view.
So I went back to an xinit approach, specifically:
xinit sleep 28800 -- display ...
The `sleep' client is for a couple reasons: first, if my process dies
(segfaults or something), then there's an as-root X server which in
some cases can be impossible to kill; at least it dies *eventually*
in this approach. Secondly, I really don't *want* ~/.xinitrc to get
sourced -- it's a source of unanticipated behavior.
To detect errors, I've got a loop checking XOpenDisplay. That alone
will never let you know that the X server failed startup, though, so I
save the PID and do a waitpid(... WNOHANG) in the loop and make sure
the X server hasn't died yet.
Haven't gotten to the auth stuff yet, but your directions/pointers
seemed straightforward -- thanks.
-tom
_______________________________________________
xorg@lists.freedesktop.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.freedesktop.org/mailman/listinfo/xorg
Your subscription address: freedesktop-xorg@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic