diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-12-02 02:38:18 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-12-02 13:23:04 +0100 |
commit | d2dc52dbc45051faa6356213a537081084e9dda4 (patch) | |
tree | b042b6eba6339a42971cf3c1ae27507bbcc202a5 /src/core/unit.c | |
parent | e5035a2778b7ed2a8ac901521ed47cf079359e68 (diff) |
systemctl: show unit file preset state in "systemctl status" output"
Diffstat (limited to 'src/core/unit.c')
-rw-r--r-- | src/core/unit.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/unit.c b/src/core/unit.c index 9df398ad4e..7daf170e29 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -92,6 +92,7 @@ Unit *unit_new(Manager *m, size_t size) { u->deserialized_job = _JOB_TYPE_INVALID; u->default_dependencies = true; u->unit_file_state = _UNIT_FILE_STATE_INVALID; + u->unit_file_preset = -1; u->on_failure_job_mode = JOB_REPLACE; return u; @@ -3090,6 +3091,17 @@ UnitFileState unit_get_unit_file_state(Unit *u) { return u->unit_file_state; } +int unit_get_unit_file_preset(Unit *u) { + assert(u); + + if (u->unit_file_preset < 0 && u->fragment_path) + u->unit_file_preset = unit_file_query_preset( + u->manager->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, + NULL, basename(u->fragment_path)); + + return u->unit_file_preset; +} + Unit* unit_ref_set(UnitRef *ref, Unit *u) { assert(ref); assert(u); |