On Wed, 30 Mar 2016 09:31:04 +0000 "Friedrich, Eugen (ADITG/SW1)" <[email protected]> wrote:
> 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 <[email protected]> > --- > src/systemd-notify.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > Hi Eugen, sorry, but it seems something has butchered the patch. All tabs have converted to spaces, there is an extra space in front of every context line, and there is some HTML garbage too. The subject line seems cut short, would be fine to just remove the "in case of" too. The feature itself seems fine to me. > 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)) { Shouldn't the argument be non-zero to clean up the environment, as Weston will launch child processes? How about looping through all file descriptors received, instead of requiring exactly one to be ever defined? It would be good to use sd_is_socket(AF_UNIX, SOCK_STREAM, yes-listening) to check for a correct socket type. > + 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 > I also seem to miss a bit of documentation. The systemd integration features were not really documented before either, but at least the ./configure --help talks only about notifications. Some words somewhere that this plugin supports systemd socket activation would be nice to add. Thanks, pq
pgpR6llE6233N.pgp
Description: OpenPGP digital signature
_______________________________________________ wayland-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/wayland-devel
