XDG_RUNTIME_DIR on a system with no "logins"

Pekka Paalanen ppaalanen at gmail.com
Thu Dec 19 13:56:29 UTC 2019

On Thu, 19 Dec 2019 10:33:09 +0000
Alan Griffiths <alan.griffiths at canonical.com> wrote:

> On 19/12/2019 10:28, Guillermo Rodriguez wrote:
> > Uhm. I am not sure I can switch to systemd at this point.
> > How does this (Weston being ready / not ready) look like from the client side?
> >
> > i.e. if I want to make sure the client is launched once Weston is ready,
> > 1. Is there any way to manually check whether Weston is ready? (e.g.
> > some sentinel file being created or similar)
> > or failing that,
> > 2. Is there any recognizable error code if the client tries to launch
> > before Weston is ready (so that I can wait a bit and retry)  
> I can't answer specifically for Weston, but I imagine this would be the
> same for any Wayland compositor.
> With our IoT solutions we wait for the $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY
> file (or $XDG_RUNTIME_DIR/wayland-0) file before trying to connect. The
> server ought to be ready once that has been created.

Yes, I can't think of why that wouldn't work, at least if you
ensure the socket file does not exist before you start Weston.

IIRC there is also a lock file to go with the socket file, but I am
unsure how to make use of that without making Weston fail. You'd
want to check the lock file is flock()'d (the compositor is using
it, so it should be ready) but you don't want to lock it yourself
(that would prevent Weston from using the socket).

The failure mode of "Weston not ready yet" is that the client
cannot connect: wl_display_connect() fails. I don't remember the
function error codes, and you'd need the client toolkit to forward
that error specifically anyway, so I'm not sure it is possible to
differentiate between connection error and other errors from a
launch script too easily.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20191219/51cc6d26/attachment.sig>

More information about the wayland-devel mailing list