mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-10-28 20:25:25 +03:00
core: fold manager_set_exec_params() into unit_set_exec_params()
Let's simplify things a bit: we so far called both functions every single time, let's just merge one into the other, so that we have fewer functions to call.
This commit is contained in:
parent
1d9cc8768f
commit
004c7f169e
@ -3703,18 +3703,6 @@ Set *manager_get_units_requiring_mounts_for(Manager *m, const char *path) {
|
||||
return hashmap_get(m->units_requiring_mounts_for, streq(p, "/") ? "" : p);
|
||||
}
|
||||
|
||||
void manager_set_exec_params(Manager *m, ExecParameters *p) {
|
||||
assert(m);
|
||||
assert(p);
|
||||
|
||||
p->environment = m->environment;
|
||||
p->confirm_spawn = manager_get_confirm_spawn(m);
|
||||
p->cgroup_supported = m->cgroup_supported;
|
||||
p->prefix = m->prefix;
|
||||
|
||||
SET_FLAG(p->flags, EXEC_PASS_LOG_UNIT|EXEC_CHOWN_DIRECTORIES, MANAGER_IS_SYSTEM(m));
|
||||
}
|
||||
|
||||
int manager_update_failed_units(Manager *m, Unit *u, bool failed) {
|
||||
unsigned size;
|
||||
int r;
|
||||
|
@ -435,8 +435,6 @@ void manager_flip_auto_status(Manager *m, bool enable);
|
||||
|
||||
Set *manager_get_units_requiring_mounts_for(Manager *m, const char *path);
|
||||
|
||||
void manager_set_exec_params(Manager *m, ExecParameters *p);
|
||||
|
||||
ManagerState manager_state(Manager *m);
|
||||
|
||||
int manager_update_failed_units(Manager *m, Unit *u, bool failed);
|
||||
|
@ -781,7 +781,6 @@ static int mount_spawn(Mount *m, ExecCommand *c, pid_t *_pid) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
manager_set_exec_params(UNIT(m)->manager, &exec_params);
|
||||
unit_set_exec_params(UNIT(m), &exec_params);
|
||||
|
||||
r = exec_spawn(UNIT(m),
|
||||
|
@ -1449,7 +1449,6 @@ static int service_spawn(
|
||||
}
|
||||
}
|
||||
|
||||
manager_set_exec_params(UNIT(s)->manager, &exec_params);
|
||||
unit_set_exec_params(UNIT(s), &exec_params);
|
||||
|
||||
final_env = strv_env_merge(2, exec_params.environment, our_env, NULL);
|
||||
|
@ -1910,7 +1910,6 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
manager_set_exec_params(UNIT(s)->manager, &exec_params);
|
||||
unit_set_exec_params(UNIT(s), &exec_params);
|
||||
|
||||
exec_params.argv = c->argv;
|
||||
|
@ -632,7 +632,6 @@ static int swap_spawn(Swap *s, ExecCommand *c, pid_t *_pid) {
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
manager_set_exec_params(UNIT(s)->manager, &exec_params);
|
||||
unit_set_exec_params(UNIT(s), &exec_params);
|
||||
|
||||
r = exec_spawn(UNIT(s),
|
||||
|
@ -4999,6 +4999,14 @@ void unit_set_exec_params(Unit *u, ExecParameters *p) {
|
||||
assert(u);
|
||||
assert(p);
|
||||
|
||||
/* Copy parameters from manager */
|
||||
p->environment = u->manager->environment;
|
||||
p->confirm_spawn = manager_get_confirm_spawn(u->manager);
|
||||
p->cgroup_supported = u->manager->cgroup_supported;
|
||||
p->prefix = u->manager->prefix;
|
||||
SET_FLAG(p->flags, EXEC_PASS_LOG_UNIT|EXEC_CHOWN_DIRECTORIES, MANAGER_IS_SYSTEM(u->manager));
|
||||
|
||||
/* Copy paramaters from unit */
|
||||
p->cgroup_path = u->cgroup_path;
|
||||
SET_FLAG(p->flags, EXEC_CGROUP_DELEGATE, unit_cgroup_delegate(u));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user