summaryrefslogtreecommitdiff
path: root/src/core/busname.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-12 21:05:32 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-15 19:02:17 +0100
commit0faacd470dfbd24f4c6504da6f04213aa05f9d19 (patch)
tree9b13b654d993efc475f9209f8b1cf602850ee27b /src/core/busname.c
parent17d1f37d0dbd2d78b8866e1350c83a9755105144 (diff)
unit: handle nicely of certain unit types are not supported on specific systems
Containers do not really support .device, .automount or .swap units; Systems compiled without support for swap do not support .swap units; Systems without kdbus do not support .busname units. With this change attempts to start a unsupported unit types will result in an immediate "unsupported" job result, which is a lot more descriptive then before. Also, attempts to start device units in containers will now immediately fail instead of causing jobs to be enqueued that never go away.
Diffstat (limited to 'src/core/busname.c')
-rw-r--r--src/core/busname.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/busname.c b/src/core/busname.c
index d4aa46339..838171fe2 100644
--- a/src/core/busname.c
+++ b/src/core/busname.c
@@ -971,6 +971,16 @@ static int busname_get_timeout(Unit *u, uint64_t *timeout) {
return 1;
}
+static bool busname_supported(Manager *m) {
+ int supported = -1;
+ assert(m);
+
+ if (supported < 0)
+ supported = access("/sys/fs/kdbus", F_OK) >= 0;
+
+ return supported;
+}
+
static const char* const busname_state_table[_BUSNAME_STATE_MAX] = {
[BUSNAME_DEAD] = "dead",
[BUSNAME_MAKING] = "making",
@@ -1032,6 +1042,8 @@ const UnitVTable busname_vtable = {
.reset_failed = busname_reset_failed,
+ .supported = busname_supported,
+
.bus_interface = "org.freedesktop.systemd1.BusName",
.bus_vtable = bus_busname_vtable,