Systemd provides a feature of socket-based activation, details in [1] This commit adds an implementation to check if socket was provided by systemd and adds this as an additional socket to wayland display. This is usefull for early rendering use-cases where weston and early-rendering-application can be started parallel.
[1] https://www.freedesktop.org/software/systemd/man/systemd.socket.html Signed-off-by: Eugen Friedrich <efriedr...@de.adit-jv.com> --- src/systemd-notify.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/systemd-notify.c b/src/systemd-notify.c index e61db0f..a921241 100644 --- a/src/systemd-notify.c +++ b/src/systemd-notify.c @@ -79,6 +79,7 @@ module_init(struct weston_compositor *compositor, struct wl_event_loop *loop; long watchdog_time_conv; struct systemd_notifier *notifier; + int fd; notifier = zalloc(sizeof *notifier); if (notifier == NULL) @@ -89,6 +90,17 @@ module_init(struct weston_compositor *compositor, wl_signal_add(&compositor->destroy_signal, ¬ifier->compositor_destroy_listener); + /*take additional display socket if provided by systemd*/ + if (1 == sd_listen_fds(0)) { + fd = SD_LISTEN_FDS_START + 0; + weston_log("info:add socket for weston created by systemd\n"); + + if (wl_display_add_socket_fd(compositor->wl_display, fd)) { + weston_log("wl_display_add_socket_fd failed\n"); + return -1; + } + } + sd_notify(0, "READY=1"); /* 'WATCHDOG_USEC' is environment variable that is set -- 1.7.9.5
_______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel