Smithay/wayland-rs

wayland-server: There is no way to bind to a passed socket FD

Opened this issue · 1 comments

ListeningSocket in wayland-server has no constructor that takes an OwnedFD, which makes it impossible to use it to implement Wayland socket handover as described in the KDE wiki.

Wayland socket handover makes it possible for a compositor to recover from crashes without the whole session dying with it, and also makes it possible to implement things like Systemd socket activation for Wayland in the future.

What's missing is a constructor for ListeningSocket that takes an OwnedFD and the socket name, and uses wl_display_add_socket_fd() to add the socket FD to the display. As far as I know, the lock file is supposed to be locked by the creator of the socket, not the receiving compositor.

I looked at the implementation of ListeningSocket and it seems to be built on the assumption that it owns the socket and the lock file. If I understand this correctly, a passed socket that is not owned by the compositor would need a different wrapper type then.