diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-07-31 18:28:02 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-07-31 18:28:02 +0200 |
commit | a43757462acaffa902417a9876486763d0b7ed58 (patch) | |
tree | 25b7bec4cdea2c75e977e5bb825789422764e9ea /src/unit.c | |
parent | 07672f492ef085a9143ce3535700c0d4e83173de (diff) |
dbus: export unit file state
Diffstat (limited to 'src/unit.c')
-rw-r--r-- | src/unit.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/unit.c b/src/unit.c index d4142098d1..e494834a61 100644 --- a/src/unit.c +++ b/src/unit.c @@ -73,6 +73,7 @@ Unit *unit_new(Manager *m) { u->meta.type = _UNIT_TYPE_INVALID; u->meta.deserialized_job = _JOB_TYPE_INVALID; u->meta.default_dependencies = true; + u->meta.unit_file_state = _UNIT_FILE_STATE_INVALID; return u; } @@ -2482,6 +2483,17 @@ int unit_following_set(Unit *u, Set **s) { return 0; } +UnitFileState unit_get_unit_file_state(Unit *u) { + assert(u); + + if (u->meta.unit_file_state < 0 && u->meta.fragment_path) + u->meta.unit_file_state = unit_file_get_state( + u->meta.manager->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, + NULL, file_name_from_path(u->meta.fragment_path)); + + return u->meta.unit_file_state; +} + static const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = { [UNIT_STUB] = "stub", [UNIT_LOADED] = "loaded", |