free(s->parameters_fragment.what);
s->parameters_fragment.what = NULL;
- exec_context_done(&s->exec_context, manager_is_reloading_or_reexecuting(u->manager));
+ cgroup_context_done(&s->cgroup_context);
+ exec_context_done(&s->exec_context);
+ s->exec_runtime = exec_runtime_unref(s->exec_runtime);
exec_command_done_array(s->exec_command, _SWAP_EXEC_COMMAND_MAX);
s->control_command = NULL;
- cgroup_context_done(&s->cgroup_context);
-
swap_unwatch_control_pid(s);
s->timer_event_source = sd_event_source_unref(s->timer_event_source);
unit_realize_cgroup(UNIT(s));
+ r = unit_setup_exec_runtime(UNIT(s));
+ if (r < 0)
+ goto fail;
+
r = swap_arm_timer(s);
if (r < 0)
goto fail;
UNIT(s)->manager->cgroup_supported,
UNIT(s)->cgroup_path,
UNIT(s)->id,
+ 0,
NULL,
+ s->exec_runtime,
&pid);
if (r < 0)
goto fail;
if (f != SWAP_SUCCESS)
s->result = f;
- exec_context_tmp_dirs_done(&s->exec_context);
+ exec_runtime_destroy(s->exec_runtime);
+ s->exec_runtime = exec_runtime_unref(s->exec_runtime);
+
swap_set_state(s, s->result != SWAP_SUCCESS ? SWAP_FAILED : SWAP_DEAD);
}
if (s->control_command_id >= 0)
unit_serialize_item(u, f, "control-command", swap_exec_command_to_string(s->control_command_id));
- exec_context_serialize(&s->exec_context, UNIT(s), f);
-
return 0;
}
s->control_command_id = id;
s->control_command = s->exec_command + id;
}
- } else if (streq(key, "tmp-dir")) {
- char *t;
-
- t = strdup(value);
- if (!t)
- return log_oom();
-
- s->exec_context.tmp_dir = t;
- } else if (streq(key, "var-tmp-dir")) {
- char *t;
-
- t = strdup(value);
- if (!t)
- return log_oom();
-
- s->exec_context.var_tmp_dir = t;
} else
log_debug_unit(u->id, "Unknown serialization key '%s'", key);
case SWAP_DEACTIVATING_SIGKILL:
case SWAP_DEACTIVATING_SIGTERM:
- if (f == SWAP_SUCCESS)
- swap_enter_dead(s, f);
- else
- swap_enter_dead(s, f);
+ swap_enter_dead(s, f);
break;
default:
}
static Unit *swap_following(Unit *u) {
- _cleanup_free_ char *p = NULL;
Swap *s = SWAP(u);
Swap *other, *first = NULL;
}
int swap_process_removed_device(Manager *m, struct udev_device *dev) {
- _cleanup_free_ char *e = NULL;
const char *dn;
int r = 0;
Swap *s;
.exec_context_offset = offsetof(Swap, exec_context),
.cgroup_context_offset = offsetof(Swap, cgroup_context),
.kill_context_offset = offsetof(Swap, kill_context),
+ .exec_runtime_offset = offsetof(Swap, exec_runtime),
.sections =
"Unit\0"
.bus_interface = "org.freedesktop.systemd1.Swap",
.bus_vtable = bus_swap_vtable,
- .bus_changing_properties = bus_swap_changing_properties,
.bus_set_property = bus_swap_set_property,
.bus_commit_properties = bus_swap_commit_properties,