mirror of
https://github.com/troglobit/finit.git
synced 2026-11-08 16:11:10 +00:00
libink: a brokerless D-Bus implementation for Finit
Finit had no way to answer the question every service manager gets asked: what is running, and change it. D-Bus is how the rest of userspace asks, but linking libdbus, sd-bus or GIO into PID 1 buys a dependency, an allocator and a main loop we do not control. So libink: the wire format, an object tree, and a bus of Finit's own at /run/finit/bus, gated like INIT_SOCKET. It speaks the standard org.freedesktop.DBus, .Peer, .Introspectable interfaces, and Finit's own Manager1, Service1 and Cond1 on top. Methods that change something are marked privileged and answered only for a caller the kernel vouched for, via SO_PEERCRED. Server and client both, since initctl is the first thing that needs to talk to it, and its Start/Stop/Restart/Reload now go over the bus rather than the legacy socket. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
ae9a24f44f
commit
0a269f3298
39 files changed
+5530
-49
No files matched your search
@@ -37,6 +37,13 @@
|
||||
#include "service.h"
|
||||
#include "sm.h"
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
/* Forward-declared locally to keep cond-w.c independent of the
|
||||
* daemon's private.h (which pulls in svc/plugin headers). The full
|
||||
* prototype lives in private.h for callers in finit's main loop. */
|
||||
void dbus_notify_condition_change(const char *name, const char *state);
|
||||
#endif
|
||||
|
||||
struct cond_boot {
|
||||
TAILQ_ENTRY(cond_boot) link;
|
||||
char *name;
|
||||
@@ -353,6 +360,9 @@ void cond_set(const char *name)
|
||||
if (cond_set_noupdate(name))
|
||||
return;
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
dbus_notify_condition_change(name, "on");
|
||||
#endif
|
||||
cond_update(name);
|
||||
}
|
||||
|
||||
@@ -383,6 +393,9 @@ void cond_set_oneshot(const char *name)
|
||||
if (cond_set_oneshot_noupdate(name))
|
||||
return;
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
dbus_notify_condition_change(name, "on");
|
||||
#endif
|
||||
cond_update(name);
|
||||
}
|
||||
|
||||
@@ -404,6 +417,9 @@ void cond_clear(const char *name)
|
||||
if (cond_clear_noupdate(name))
|
||||
return;
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
dbus_notify_condition_change(name, "off");
|
||||
#endif
|
||||
cond_update(name);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user