1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
From ee7240469583e9ab5124ba6c3df12c91050f177e Mon Sep 17 00:00:00 2001
From: Swagtoy <me@ow.swag.toys>
Date: Wed, 27 May 2026 17:57:33 -0400
Subject: [PATCH] shell: elogind support to avoid stubbed sd_notify
sd_notify is supported by elogind (with such an unfortunate name) and
openrc's supervise-daemon is able to get at READY=1. Unfortunately, it
is stubbed, so let's start using it if -Dsystemd=off and elogind is
found.
Signed-off-by: Swagtoy <me@ow.swag.toys>
---
config.h.meson | 3 +++
meson.build | 6 +++++-
src/shell-util.c | 4 +++-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/config.h.meson b/config.h.meson
index a357e1c1f..2c4923617 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -28,6 +28,9 @@
/* Define if we have systemd */
#mesondefine HAVE_SYSTEMD
+/* Define if we have elogind */
+#mesondefine HAVE_ELOGIND
+
/* Define if _NL_TIME_FIRST_WEEKDATE is available */
#mesondefine HAVE__NL_TIME_FIRST_WEEKDAY
diff --git a/meson.build b/meson.build
index 14ba11953..05d0bc910 100644
--- a/meson.build
+++ b/meson.build
@@ -129,9 +129,12 @@ if get_option('systemd')
systemd_dep = dependency('systemd', version: systemd_req)
systemduserunitdir = systemd_dep.get_variable('systemduserunitdir',
pkgconfig_define: ['prefix', prefix])
+ have_elogind = false
have_systemd = true
else
- libsystemd_dep = []
+ # elogind isn't required either, but reap the benefits if it does exists
+ libsystemd_dep = dependency('libelogind', required: false)
+ have_elogind = libsystemd_dep.found()
have_systemd = false
endif
@@ -154,6 +157,7 @@ cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name())
cdata.set_quoted('VERSION', meson.project_version())
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
+cdata.set('HAVE_ELOGIND', have_elogind)
cdata.set('HAVE_NETWORKMANAGER', have_networkmanager)
cdata.set('HAVE_PIPEWIRE', have_pipewire)
cdata.set('HAVE_SYSTEMD', have_systemd)
diff --git a/src/shell-util.c b/src/shell-util.c
index 21fe7a7f4..ecc3c169c 100644
--- a/src/shell-util.c
+++ b/src/shell-util.c
@@ -35,11 +35,13 @@
#ifdef HAVE_SYSTEMD
#include <systemd/sd-daemon.h>
#include <systemd/sd-login.h>
+#elif defined(HAVE_ELOGIND)
+#include <elogind/sd-daemon.h>
#else
/* So we don't need to add ifdef's everywhere */
#define sd_notify(u, m) do {} while (0)
#define sd_notifyf(u, m, ...) do {} while (0)
-#endif
+#endif /* HAVE_SYSTEMD */
static void
stop_pick (ClutterActor *actor)
--
2.53.0
|