HALF ECHO LEARN / REFERENCE COLLECTION
v262.2src/core/service.c
Git blob: 5c097c139d401c81662897faf4f6e6779f5302c7
Lines 6001–6768 of 6,768
if (r < 0)
log_unit_debug_errno(u, r, "Failed to request owner PID of service name, ignoring: %m");
}
}
int service_set_socket_fd(
Service *s,
int fd,
Socket *sock,
SocketPeer *peer, /* reference to object is donated to us on success */
bool selinux_context_net) {
_cleanup_free_ char *peer_text = NULL;
int r;
assert(s);
assert(fd >= 0);
assert(sock);
/* This is called by the socket code when instantiating a new service for a stream socket and the socket needs
* to be configured. We take ownership of the passed fd on success. */
if (UNIT(s)->load_state != UNIT_LOADED)
return -EINVAL;
if (s->socket_fd >= 0)
return -EBUSY;
assert(!s->socket_peer);
if (!IN_SET(s->state, SERVICE_DEAD, SERVICE_DEAD_RESOURCES_PINNED))
return -EAGAIN;
if (getpeername_pretty(fd, true, &peer_text) >= 0) {
if (UNIT(s)->description) {
_cleanup_free_ char *a = NULL;
a = strjoin(UNIT(s)->description, " (", peer_text, ")");
if (!a)
return -ENOMEM;
r = unit_set_description(UNIT(s), a);
} else
r = unit_set_description(UNIT(s), peer_text);
if (r < 0)
return r;
}
r = unit_add_two_dependencies(UNIT(s), UNIT_AFTER, UNIT_TRIGGERED_BY, UNIT(sock), false, UNIT_DEPENDENCY_IMPLICIT);
if (r < 0)
return log_unit_debug_errno(UNIT(s), r,
"Failed to add After=/TriggeredBy= dependencies on socket unit: %m");
s->socket_fd = fd;
s->socket_peer = peer;
s->socket_fd_selinux_context_net = selinux_context_net;
unit_ref_set(&s->accept_socket, UNIT(s), UNIT(sock));
return 0;
}
static void service_reset_failed(Unit *u) {
Service *s = ASSERT_PTR(SERVICE(u));
if (s->state == SERVICE_FAILED)
service_set_state(s, service_determine_dead_state(s));
s->result = SERVICE_SUCCESS;
s->reload_result = SERVICE_SUCCESS;
s->live_mount_result = SERVICE_SUCCESS;
s->clean_result = SERVICE_SUCCESS;
s->n_restarts = 0;
}
static PidRef* service_main_pid(Unit *u, bool *ret_is_alien) {
Service *s = ASSERT_PTR(SERVICE(u));
if (ret_is_alien)
*ret_is_alien = s->main_pid_alien;
return &s->main_pid;
}
static PidRef* service_control_pid(Unit *u) {
return &ASSERT_PTR(SERVICE(u))->control_pid;
}
static bool service_needs_console(Unit *u) {
Service *s = ASSERT_PTR(SERVICE(u));
/* We provide our own implementation of this here, instead of relying of the generic implementation
* unit_needs_console() provides, since we want to return false if we are in SERVICE_EXITED state. */
if (!exec_context_may_touch_console(&s->exec_context))
return false;
return IN_SET(s->state,
SERVICE_CONDITION,
SERVICE_START_PRE,
SERVICE_START,
SERVICE_START_POST,
SERVICE_RUNNING,
SERVICE_RUNNING_REVALIDATING,
SERVICE_REFRESH_EXTENSIONS,
SERVICE_REFRESH_CREDENTIALS,
SERVICE_RELOAD,
SERVICE_RELOAD_SIGNAL,
SERVICE_RELOAD_NOTIFY,
SERVICE_RELOAD_POST,
SERVICE_MOUNTING,
SERVICE_STOP,
SERVICE_STOP_WATCHDOG,
SERVICE_STOP_SIGTERM,
SERVICE_STOP_SIGKILL,
SERVICE_STOP_POST,
SERVICE_FINAL_WATCHDOG,
SERVICE_FINAL_SIGTERM,
SERVICE_FINAL_SIGKILL);
}
static int service_exit_status(Unit *u) {
Service *s = ASSERT_PTR(SERVICE(u));
if (s->main_exec_status.pid <= 0 ||
!dual_timestamp_is_set(&s->main_exec_status.exit_timestamp))
return -ENODATA;
if (s->main_exec_status.code != CLD_EXITED)
return -EBADE;
return s->main_exec_status.status;
}
static const char* service_status_text(Unit *u) {
Service *s = ASSERT_PTR(SERVICE(u));
return s->status_text;
}
static int service_clean(Unit *u, ExecCleanMask mask) {
Service *s = ASSERT_PTR(SERVICE(u));
_cleanup_strv_free_ char **l = NULL;
bool may_clean_fdstore = false;
int r;
assert(mask != 0);
if (!IN_SET(s->state, SERVICE_DEAD, SERVICE_DEAD_RESOURCES_PINNED))
return -EBUSY;
/* Determine if there's anything we could potentially clean */
r = exec_context_get_clean_directories(&s->exec_context, u->manager->prefix, mask, &l);
if (r < 0)
return r;
if (mask & EXEC_CLEAN_FDSTORE)
may_clean_fdstore = s->n_fd_store > 0 || s->n_fd_store_max > 0;
if (strv_isempty(l) && !may_clean_fdstore)
return -EUNATCH; /* Nothing to potentially clean */
/* Let's clean the stuff we can clean quickly */
if (may_clean_fdstore)
service_release_fd_store(s);
/* If we are done, leave quickly */
if (strv_isempty(l)) {
if (s->state == SERVICE_DEAD_RESOURCES_PINNED && !SERVICE_FD_STORE_POPULATED(s))
service_set_state(s, SERVICE_DEAD);
return 0;
}
/* We need to clean disk stuff. This is slow, hence do it out of process, and change state */
service_unwatch_control_pid(s);
s->clean_result = SERVICE_SUCCESS;
s->control_command = NULL;
s->control_command_id = _SERVICE_EXEC_COMMAND_INVALID;
r = service_arm_timer(s, /* relative= */ true, s->exec_context.timeout_clean_usec);
if (r < 0) {
log_unit_warning_errno(u, r, "Failed to install timer: %m");
goto fail;
}
unit_cgroup_disable_all_controllers(u);
r = unit_fork_and_watch_rm_rf(u, l, &s->control_pid);
if (r < 0) {
log_unit_warning_errno(u, r, "Failed to spawn cleaning task: %m");
goto fail;
}
service_set_state(s, SERVICE_CLEANING);
return 0;
fail:
s->clean_result = SERVICE_FAILURE_RESOURCES;
s->timer_event_source = sd_event_source_disable_unref(s->timer_event_source);
return r;
}
static int service_can_clean(Unit *u, ExecCleanMask *ret) {
Service *s = ASSERT_PTR(SERVICE(u));
ExecCleanMask mask = 0;
int r;
assert(ret);
r = exec_context_get_clean_mask(&s->exec_context, &mask);
if (r < 0)
return r;
if (s->n_fd_store_max > 0)
mask |= EXEC_CLEAN_FDSTORE;
*ret = mask;
return 0;
}
static int service_live_mount(
Unit *u,
const char *src,
const char *dst,
sd_bus_message *message,
MountInNamespaceFlags flags,
const MountOptions *options,
sd_bus_error *reterr_error) {
Service *s = ASSERT_PTR(SERVICE(u));
_cleanup_(pidref_done) PidRef worker = PIDREF_NULL;
int r;
assert(u);
assert(u->manager);
assert(src);
assert(dst);
assert(message);
assert(!s->mount_request);
if (s->state != SERVICE_RUNNING || !pidref_is_set(&s->main_pid)) {
log_unit_warning(u, "Service is not running, cannot live mount.");
return sd_bus_error_setf(
reterr_error,
BUS_ERROR_UNIT_INACTIVE,
"Live mounting '%s' on '%s' for unit '%s' cannot be scheduled: service not running",
src,
dst,
u->id);
}
if (mount_point_is_credentials(u->manager->prefix[EXEC_DIRECTORY_RUNTIME], dst)) {
log_unit_warning(u, "Refusing to live mount over credential mount '%s'.", dst);
return sd_bus_error_setf(
reterr_error,
SD_BUS_ERROR_INVALID_ARGS,
"Live mounting '%s' on '%s' for unit '%s' cannot be scheduled: cannot mount over credential mount",
src,
dst,
u->id);
}
if (path_startswith_strv(dst, s->exec_context.inaccessible_paths)) {
log_unit_warning(u, "%s is not accessible to this unit, cannot live mount.", dst);
return sd_bus_error_setf(
reterr_error,
SD_BUS_ERROR_INVALID_ARGS,
"Live mounting '%s' on '%s' for unit '%s' cannot be scheduled: destination is not accessible to this unit",
src,
dst,
u->id);
}
service_unwatch_control_pid(s);
s->live_mount_result = SERVICE_SUCCESS;
s->control_command = NULL;
s->control_command_id = _SERVICE_EXEC_COMMAND_INVALID;
r = service_arm_timer(s, /* relative= */ true, s->timeout_start_usec);
if (r < 0) {
log_unit_error_errno(u, r, "Failed to install timer: %m");
sd_bus_error_set_errnof(reterr_error, r,
"Live mounting '%s' on '%s' for unit '%s': failed to install timer: %m",
src, dst, u->id);
goto fail;
}
const char *propagate_directory = strjoina("/run/systemd/propagate/", u->id);
/* Given we are running from PID1, avoid doing potentially heavy I/O operations like opening images
* directly, and instead fork a worker process. We record the D-Bus message, so that we can reply
* after the operation has finished. This way callers can wait on the message and know that the new
* resource is available (or the operation failed) once they receive the response. */
r = unit_fork_helper_process_full(u, "(sd-mount-in-ns)", /* into_cgroup= */ false,
FORK_ALLOW_DLOPEN,
&worker);
if (r < 0) {
log_unit_error_errno(u, r,
"Failed to fork process to mount '%s' on '%s' in unit's namespace: %m",
src, dst);
sd_bus_error_set_errnof(reterr_error, r,
"Live mounting '%s' on '%s' for unit '%s': failed to fork off helper process into namespace: %m",
src, dst, u->id);
goto fail;
}
if (r == 0) {
LOG_CONTEXT_PUSH_UNIT(u);
if (flags & MOUNT_IN_NAMESPACE_IS_IMAGE)
r = mount_image_in_namespace(
&s->main_pid,
propagate_directory,
"/run/systemd/incoming/",
src, dst,
flags,
options,
s->exec_context.mount_image_policy ?: &image_policy_service);
else
r = bind_mount_in_namespace(
&s->main_pid,
propagate_directory,
"/run/systemd/incoming/",
src, dst,
flags);
if (r < 0)
log_unit_error_errno(u, r,
"Failed to mount '%s' on '%s' in unit's namespace: %m",
src, dst);
else
log_unit_debug(u, "Mounted '%s' on '%s' in unit's namespace", src, dst);
_exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
}
r = unit_watch_pidref(u, &worker, /* exclusive= */ true);
if (r < 0) {
log_unit_warning_errno(u, r, "Failed to watch live mount helper process: %m");
sd_bus_error_set_errnof(reterr_error, r,
"Live mounting '%s' on '%s' for unit '%s': failed to watch live mount helper process: %m",
src, dst, u->id);
goto fail;
}
s->mount_request = sd_bus_message_ref(message);
s->control_pid = TAKE_PIDREF(worker);
service_set_state(s, SERVICE_MOUNTING);
return 0;
fail:
s->live_mount_result = SERVICE_FAILURE_RESOURCES;
service_enter_running(s, SERVICE_SUCCESS);
return r;
}
static int service_can_live_mount(Unit *u, sd_bus_error *reterr_error) {
Service *s = ASSERT_PTR(SERVICE(u));
/* Ensure that the unit runs in a private mount namespace */
if (!exec_needs_mount_namespace(&s->exec_context, /* params= */ NULL))
return sd_bus_error_setf(
reterr_error,
SD_BUS_ERROR_INVALID_ARGS,
"Unit '%s' not running in private mount namespace, cannot live mount.",
u->id);
return 0;
}
static const char* service_finished_job(Unit *u, JobType t, JobResult result) {
Service *s = ASSERT_PTR(SERVICE(u));
if (t == JOB_START &&
result == JOB_DONE &&
s->type == SERVICE_ONESHOT)
return "Finished %s.";
/* Fall back to generic */
return NULL;
}
static int service_test_startable(Unit *u) {
Service *s = ASSERT_PTR(SERVICE(u));
int r;
/* First check the state, and do not increment start limit counter if the service cannot start due to
* that e.g. it is already being started. Note, the service states mapped to UNIT_ACTIVE,
* UNIT_RELOADING, UNIT_DEACTIVATING, UNIT_MAINTENANCE, and UNIT_REFRESHING are already filtered in
* unit_start(). Hence, here we only need to check states that mapped to UNIT_ACTIVATING. */
if (IN_SET(s->state, SERVICE_CONDITION, SERVICE_START_PRE, SERVICE_START, SERVICE_START_POST))
return false;
/* Make sure we don't enter a busy loop of some kind. */
r = unit_test_start_limit(u);
if (r < 0) {
service_enter_dead(s, SERVICE_FAILURE_START_LIMIT_HIT, false);
return r;
}
return true;
}
static void service_release_resources(Unit *u) {
Service *s = ASSERT_PTR(SERVICE(u));
/* Invoked by the unit state engine, whenever it realizes that unit is dead and there's no job
* anymore for it, and it hence is a good idea to release resources */
/* Don't release resources if this is a transitionary failed/dead state
* (i.e. SERVICE_DEAD_BEFORE_AUTO_RESTART/SERVICE_FAILED_BEFORE_AUTO_RESTART), insist on a permanent
* failure state. */
if (!IN_SET(s->state, SERVICE_DEAD, SERVICE_FAILED, SERVICE_DEAD_RESOURCES_PINNED))
return;
log_unit_debug(u, "Releasing resources...");
service_release_socket_fd(s);
service_release_stdio_fd(s);
service_release_extra_fds(s);
s->root_directory_fd = asynchronous_close(s->root_directory_fd);
if (IN_SET(s->fd_store_preserve_mode, EXEC_PRESERVE_NO, EXEC_PRESERVE_RESTART) ||
(s->fd_store_preserve_mode == EXEC_PRESERVE_ON_SUCCESS && s->state == SERVICE_FAILED))
service_release_fd_store(s);
if (s->state == SERVICE_DEAD_RESOURCES_PINNED && !SERVICE_FD_STORE_POPULATED(s))
service_set_state(s, SERVICE_DEAD);
}
int service_determine_exec_selinux_label(Service *s, char **ret) {
int r;
assert(s);
assert(ret);
if (!mac_selinux_use())
return -ENODATA;
/* Returns the SELinux label used for execution of the main service binary */
if (s->exec_context.selinux_context)
/* Prefer the explicitly configured label if there is one */
return strdup_to(ret, s->exec_context.selinux_context);
if (s->exec_context.root_image ||
s->exec_context.n_extension_images > 0 ||
!strv_isempty(s->exec_context.extension_directories) ||
s->exec_context.root_mstack) /* We cannot chase paths through images */
return log_unit_debug_errno(UNIT(s), SYNTHETIC_ERRNO(ENODATA), "Service with RootImage=, ExtensionImages=, ExtensionDirectories= or RootMStack= set cannot determine socket SELinux label before activation, ignoring.");
ExecCommand *c = s->exec_command[SERVICE_EXEC_START];
if (!c)
return -ENODATA;
_cleanup_free_ char *path = NULL;
if (s->exec_context.root_directory_as_fd)
r = chaseat(s->root_directory_fd, s->root_directory_fd, c->path, CHASE_TRIGGER_AUTOFS, &path, NULL);
else
r = chase(c->path, s->exec_context.root_directory, CHASE_PREFIX_ROOT|CHASE_TRIGGER_AUTOFS, &path, NULL);
if (r < 0) {
log_unit_debug_errno(UNIT(s), r, "Failed to resolve service binary '%s', ignoring: %m", c->path);
return -ENODATA;
}
r = mac_selinux_get_create_label_from_exe(path, ret);
if (ERRNO_IS_NEG_NOT_SUPPORTED(r)) {
log_unit_debug_errno(UNIT(s), r, "Reading SELinux label off binary '%s' is not supported, ignoring: %m", path);
return -ENODATA;
}
if (ERRNO_IS_NEG_PRIVILEGE(r)) {
log_unit_debug_errno(UNIT(s), r, "Can't read SELinux label off binary '%s', due to privileges, ignoring: %m", path);
return -ENODATA;
}
if (r < 0) {
if (mac_selinux_enforcing())
return log_unit_debug_errno(UNIT(s), r, "Failed to read SELinux label off binary '%s': %m", path);
log_unit_debug_errno(UNIT(s), r, "Failed to read SELinux label off binary '%s', SELinux in permissive mode, ignoring: %m", path);
return -ENODATA;
}
return 0;
}
static int service_freezer_action(Unit *u, FreezerAction action) {
Service *s = ASSERT_PTR(SERVICE(u));
FreezerState old_objective, new_objective;
int r;
old_objective = freezer_state_objective(u->freezer_state);
r = unit_cgroup_freezer_action(u, action);
if (r < 0)
return r;
new_objective = freezer_state_objective(u->freezer_state);
/* Note that we cannot trivially check the retval of unit_cgroup_freezer_action() here, since
* that signals whether the operation is ongoing from *kernel's PoV*. If the freeze operation
* is aborted, the frozen attribute of the cgroup would never have been flipped in kernel,
* and unit_cgroup_freezer_action() will happily return 0, yet the watchdog still needs to be reset;
* vice versa. */
if (old_objective != new_objective) {
if (new_objective == FREEZER_FROZEN)
service_stop_watchdog(s);
else if (new_objective == FREEZER_RUNNING)
service_reset_watchdog(s);
else
assert_not_reached();
}
return r;
}
static const char* const service_restart_table[_SERVICE_RESTART_MAX] = {
[SERVICE_RESTART_NO] = "no",
[SERVICE_RESTART_ON_SUCCESS] = "on-success",
[SERVICE_RESTART_ON_FAILURE] = "on-failure",
[SERVICE_RESTART_ON_ABNORMAL] = "on-abnormal",
[SERVICE_RESTART_ON_WATCHDOG] = "on-watchdog",
[SERVICE_RESTART_ON_ABORT] = "on-abort",
[SERVICE_RESTART_ALWAYS] = "always",
};
DEFINE_STRING_TABLE_LOOKUP(service_restart, ServiceRestart);
static const char* const service_restart_mode_table[_SERVICE_RESTART_MODE_MAX] = {
[SERVICE_RESTART_MODE_NORMAL] = "normal",
[SERVICE_RESTART_MODE_DIRECT] = "direct",
[SERVICE_RESTART_MODE_DEBUG] = "debug",
};
DEFINE_STRING_TABLE_LOOKUP(service_restart_mode, ServiceRestartMode);
static const char* const service_type_table[_SERVICE_TYPE_MAX] = {
[SERVICE_SIMPLE] = "simple",
[SERVICE_FORKING] = "forking",
[SERVICE_ONESHOT] = "oneshot",
[SERVICE_DBUS] = "dbus",
[SERVICE_NOTIFY] = "notify",
[SERVICE_NOTIFY_RELOAD] = "notify-reload",
[SERVICE_IDLE] = "idle",
[SERVICE_EXEC] = "exec",
};
DEFINE_STRING_TABLE_LOOKUP(service_type, ServiceType);
static const char* const service_exit_type_table[_SERVICE_EXIT_TYPE_MAX] = {
[SERVICE_EXIT_MAIN] = "main",
[SERVICE_EXIT_CGROUP] = "cgroup",
};
DEFINE_STRING_TABLE_LOOKUP(service_exit_type, ServiceExitType);
static const char* const service_exec_command_table[_SERVICE_EXEC_COMMAND_MAX] = {
[SERVICE_EXEC_CONDITION] = "ExecCondition",
[SERVICE_EXEC_START_PRE] = "ExecStartPre",
[SERVICE_EXEC_START] = "ExecStart",
[SERVICE_EXEC_START_POST] = "ExecStartPost",
[SERVICE_EXEC_RELOAD] = "ExecReload",
[SERVICE_EXEC_RELOAD_POST] = "ExecReloadPost",
[SERVICE_EXEC_STOP] = "ExecStop",
[SERVICE_EXEC_STOP_POST] = "ExecStopPost",
};
DEFINE_STRING_TABLE_LOOKUP(service_exec_command, ServiceExecCommand);
static const char* const service_exec_ex_command_table[_SERVICE_EXEC_COMMAND_MAX] = {
[SERVICE_EXEC_CONDITION] = "ExecConditionEx",
[SERVICE_EXEC_START_PRE] = "ExecStartPreEx",
[SERVICE_EXEC_START] = "ExecStartEx",
[SERVICE_EXEC_START_POST] = "ExecStartPostEx",
[SERVICE_EXEC_RELOAD] = "ExecReloadEx",
[SERVICE_EXEC_RELOAD_POST] = "ExecReloadPostEx",
[SERVICE_EXEC_STOP] = "ExecStopEx",
[SERVICE_EXEC_STOP_POST] = "ExecStopPostEx",
};
DEFINE_STRING_TABLE_LOOKUP(service_exec_ex_command, ServiceExecCommand);
static const char* const notify_state_table[_NOTIFY_STATE_MAX] = {
[NOTIFY_READY] = "ready",
[NOTIFY_RELOADING] = "reloading",
[NOTIFY_RELOAD_READY] = "reload-ready",
[NOTIFY_STOPPING] = "stopping",
};
DEFINE_STRING_TABLE_LOOKUP(notify_state, NotifyState);
static const char* const service_result_table[_SERVICE_RESULT_MAX] = {
[SERVICE_SUCCESS] = "success",
[SERVICE_FAILURE_RESOURCES] = "resources",
[SERVICE_FAILURE_PROTOCOL] = "protocol",
[SERVICE_FAILURE_TIMEOUT] = "timeout",
[SERVICE_FAILURE_EXIT_CODE] = "exit-code",
[SERVICE_FAILURE_SIGNAL] = "signal",
[SERVICE_FAILURE_CORE_DUMP] = "core-dump",
[SERVICE_FAILURE_WATCHDOG] = "watchdog",
[SERVICE_FAILURE_START_LIMIT_HIT] = "start-limit-hit",
[SERVICE_FAILURE_OOM_KILL] = "oom-kill",
[SERVICE_SKIP_CONDITION] = "exec-condition",
};
DEFINE_STRING_TABLE_LOOKUP(service_result, ServiceResult);
static const char* const service_timeout_failure_mode_table[_SERVICE_TIMEOUT_FAILURE_MODE_MAX] = {
[SERVICE_TIMEOUT_TERMINATE] = "terminate",
[SERVICE_TIMEOUT_ABORT] = "abort",
[SERVICE_TIMEOUT_KILL] = "kill",
};
DEFINE_STRING_TABLE_LOOKUP(service_timeout_failure_mode, ServiceTimeoutFailureMode);
static const struct {
ServiceRefreshOnReload flag;
const char *name;
} service_refresh_on_reload_table[] = {
{ SERVICE_RELOAD_EXTENSIONS, "extensions" },
{ SERVICE_RELOAD_CREDENTIALS, "credentials" },
};
ServiceRefreshOnReload service_refresh_on_reload_flag_from_string(const char *s) {
assert(s);
FOREACH_ELEMENT(i, service_refresh_on_reload_table)
if (streq(s, i->name))
return i->flag;
return _SERVICE_REFRESH_ON_RELOAD_INVALID;
}
int service_refresh_on_reload_from_string_many(const char *s, ServiceRefreshOnReload *ret) {
ServiceRefreshOnReload flags = 0;
int r;
assert(s);
assert(ret);
for (;;) {
_cleanup_free_ char *v = NULL;
ServiceRefreshOnReload f;
r = extract_first_word(&s, &v, NULL, 0);
if (r < 0)
return r;
if (r == 0)
break;
f = service_refresh_on_reload_flag_from_string(v);
if (f < 0)
return f;
assert(f > 0);
flags |= f;
}
*ret = flags;
return 0;
}
int service_refresh_on_reload_to_strv(ServiceRefreshOnReload flags, char ***ret) {
_cleanup_strv_free_ char **l = NULL;
int r;
assert(flags >= 0);
assert(ret);
FOREACH_ELEMENT(i, service_refresh_on_reload_table) {
if (!FLAGS_SET(flags, i->flag))
continue;
r = strv_extend(&l, i->name);
if (r < 0)
return r;
}
*ret = TAKE_PTR(l);
return 0;
}
const UnitVTable service_vtable = {
.object_size = sizeof(Service),
.exec_context_offset = offsetof(Service, exec_context),
.cgroup_context_offset = offsetof(Service, cgroup_context),
.kill_context_offset = offsetof(Service, kill_context),
.exec_runtime_offset = offsetof(Service, exec_runtime),
.cgroup_runtime_offset = offsetof(Service, cgroup_runtime),
.sections =
"Unit\0"
"Service\0"
"Install\0",
.private_section = "Service",
.can_transient = true,
.can_delegate = true,
.can_fail = true,
.can_set_managed_oom = true,
.notify_plymouth = true,
.track_orphaned = true,
.init = service_init,
.done = service_done,
.load = service_load,
.release_resources = service_release_resources,
.coldplug = service_coldplug,
.dump = service_dump,
.start = service_start,
.stop = service_stop,
.reload = service_reload,
.can_reload = service_can_reload,
.clean = service_clean,
.can_clean = service_can_clean,
.live_mount = service_live_mount,
.can_live_mount = service_can_live_mount,
.freezer_action = service_freezer_action,
.serialize = service_serialize,
.deserialize_item = service_deserialize_item,
.attach_external_fd_to_fdstore = service_attach_external_fd_to_fdstore,
.active_state = service_active_state,
.sub_state_to_string = service_sub_state_to_string,
.will_restart = service_will_restart,
.may_gc = service_may_gc,
.sigchld_event = service_sigchld_event,
.reset_failed = service_reset_failed,
.notify_cgroup_empty = service_notify_cgroup_empty_event,
.notify_cgroup_oom = service_notify_cgroup_oom_event,
.notify_message = service_notify_message,
.notify_handoff_timestamp = service_handoff_timestamp,
.notify_pidref = service_notify_pidref,
.main_pid = service_main_pid,
.control_pid = service_control_pid,
.bus_name_owner_change = service_bus_name_owner_change,
.bus_set_property = bus_service_set_property,
.bus_commit_properties = bus_service_commit_properties,
.get_timeout = service_get_timeout,
.get_timeout_start_usec = service_get_timeout_start_usec,
.needs_console = service_needs_console,
.exit_status = service_exit_status,
.status_text = service_status_text,
.status_message_formats = {
.finished_job = service_finished_job,
},
.test_startable = service_test_startable,
.audit_start_message_type = AUDIT_SERVICE_START,
.audit_stop_message_type = AUDIT_SERVICE_STOP,
};