+static int manager_connect_plymouth(Manager *m) {
+ union sockaddr_union sa = PLYMOUTH_SOCKET;
+ int r;
+
+ /* try to connect or reconnect if sending a message */
+ if (m->plymouth_fd >= 0)
+ return 0;
+
+ m->plymouth_fd = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0);
+ if (m->plymouth_fd < 0)
+ return log_warning_errno(errno, "Connection to plymouth socket failed: %m");
+
+ if (connect(m->plymouth_fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sa.un.sun_path+1)) < 0) {
+ r = log_warning_errno(errno, "Couldn't connect to plymouth: %m");
+ goto fail;
+ }
+
+ r = sd_event_add_io(m->event, &m->plymouth_event_source, m->plymouth_fd, EPOLLIN, manager_plymouth_feedback_handler, m);
+ if (r < 0) {
+ log_warning_errno(r, "Can't listen to plymouth socket: %m");
+ goto fail;
+ }
+
+ return 1;
+
+fail:
+ manager_disconnect_plymouth(m);
+ return r;
+}
+
+static int plymouth_send_message(int plymouth_fd, const char *message, bool update) {