summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 4eea5b57ae..1e33936346 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2684,6 +2684,17 @@ int unit_exec_context_defaults(Unit *u, ExecContext *c) {
return 0;
}
+ExecContext *unit_get_exec_context(Unit *u) {
+ size_t offset;
+ assert(u);
+
+ offset = UNIT_VTABLE(u)->exec_context_offset;
+ if (offset <= 0)
+ return NULL;
+
+ return (ExecContext*) ((uint8_t*) u + offset);
+}
+
static const char* const unit_active_state_table[_UNIT_ACTIVE_STATE_MAX] = {
[UNIT_ACTIVE] = "active",
[UNIT_RELOADING] = "reloading",