[psplash][PATCH 2/2] Fix psplash-systemd failures


Scott Murray
 

To avoid racing on FIFO creation between psplash and psplash-systemd,
enhance the systemd support by adding a call to sd_notify in psplash
after the FIFO is created. That will alow setting the psplash-start
systemd unit type to "notify" to avoid the race.

Signed-off-by: Scott Murray <scott.murray@...>
---
Makefile.am | 2 ++
psplash.c | 7 +++++++
2 files changed, 9 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 5f3fc42..310e126 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,6 +11,8 @@ BUILT_SOURCES =3D psplash-poky-img.h psplash-bar-img.h
psplash_write_SOURCES =3D psplash-write.c psplash.h
=20
if HAVE_SYSTEMD
+psplash_CPPFLAGS =3D $(SYSTEMD_CFLAGS) -DHAVE_SYSTEMD
+psplash_LDFLAGS=3D $(SYSTEMD_LIBS)
bin_PROGRAMS +=3D psplash-systemd
psplash_systemd_CPPFLAGS =3D $(SYSTEMD_CFLAGS)
psplash_systemd_LDFLAGS=3D $(SYSTEMD_LIBS)
diff --git a/psplash.c b/psplash.c
index e5dff16..1a56629 100644
--- a/psplash.c
+++ b/psplash.c
@@ -15,6 +15,9 @@
#include "psplash-colors.h"
#include "psplash-poky-img.h"
#include "psplash-bar-img.h"
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
#include FONT_HEADER
=20
#define SPLIT_LINE_POS(fb) \
@@ -285,6 +288,10 @@ main (int argc, char** argv)
goto fb_fail;
}
=20
+#ifdef HAVE_SYSTEMD
+ sd_notify(0, "READY=3D1");
+#endif
+
/* Clear the background with #ecece1 */
psplash_fb_draw_rect (fb, 0, 0, fb->width, fb->height,
PSPLASH_BACKGROUND_COLOR);
--=20
2.24.1

Join yocto@lists.yoctoproject.org to automatically receive all group messages.