summaryrefslogtreecommitdiff
path: root/src/core/manager.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/manager.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/manager.c')
-rw-r--r--src/core/manager.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 7653850cd4..afd911d899 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -946,20 +946,29 @@ Manager* manager_free(Manager *m) {
}
int manager_enumerate(Manager *m) {
- int r = 0, q;
+ int r = 0;
UnitType c;
assert(m);
/* Let's ask every type to load all units from disk/kernel
* that it might know */
- for (c = 0; c < _UNIT_TYPE_MAX; c++)
- if (unit_vtable[c]->enumerate) {
- q = unit_vtable[c]->enumerate(m);
- if (q < 0)
- r = q;
+ for (c = 0; c < _UNIT_TYPE_MAX; c++) {
+ int q;
+
+ if (unit_vtable[c]->supported && !unit_vtable[c]->supported(m)) {
+ log_info("Unit type .%s is not supported on this system.", unit_type_to_string(c));
+ continue;
}
+ if (!unit_vtable[c]->enumerate)
+ continue;
+
+ q = unit_vtable[c]->enumerate(m);
+ if (q < 0)
+ r = q;
+ }
+
manager_dispatch_load_queue(m);
return r;
}