diff options
author | Daniel Mack <zonque@gmail.com> | 2014-08-23 15:28:37 +0200 |
---|---|---|
committer | Daniel Mack <daniel@zonque.org> | 2014-09-05 12:18:57 +0200 |
commit | 9fa95f8539a380e93f760956bc6982e57f5bf3af (patch) | |
tree | f774c011d5563d2d381e91e1b50ac5c1e2e674e6 /src/core/service.c | |
parent | a4390b6be8869172ccdd16fef208803fc6c7a114 (diff) |
exec: factor out most function arguments of exec_spawn() to ExecParameters
This way, the list of arguments to that function gets more comprehensive,
and we can get around passing lots of NULL and 0 arguments from socket.c,
swap.c and mount.c.
It also allows for splitting up the code in exec_spawn().
While at it, make ExecContext const in execute.c.
Diffstat (limited to 'src/core/service.c')
-rw-r--r-- | src/core/service.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/core/service.c b/src/core/service.c index 223e4b3a41..f3775f24c4 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -892,6 +892,11 @@ static int service_spawn( _cleanup_strv_free_ char **argv = NULL, **final_env = NULL, **our_env = NULL; const char *path; + ExecParameters exec_params = { + .apply_permissions = apply_permissions, + .apply_chroot = apply_chroot, + .apply_tty_stdin = apply_tty_stdin, + }; assert(s); assert(c); @@ -967,21 +972,22 @@ static int service_spawn( } else path = UNIT(s)->cgroup_path; + exec_params.argv = argv; + exec_params.fds = fds; + exec_params.n_fds = n_fds; + exec_params.environment = final_env; + exec_params.confirm_spawn = UNIT(s)->manager->confirm_spawn; + exec_params.cgroup_supported = UNIT(s)->manager->cgroup_supported; + exec_params.cgroup_path = path; + exec_params.runtime_prefix = manager_get_runtime_prefix(UNIT(s)->manager); + exec_params.unit_id = UNIT(s)->id; + exec_params.watchdog_usec = s->watchdog_usec; + if (s->type == SERVICE_IDLE) + exec_params.idle_pipe = UNIT(s)->manager->idle_pipe; + r = exec_spawn(c, - argv, &s->exec_context, - fds, n_fds, - final_env, - apply_permissions, - apply_chroot, - apply_tty_stdin, - UNIT(s)->manager->confirm_spawn, - UNIT(s)->manager->cgroup_supported, - path, - manager_get_runtime_prefix(UNIT(s)->manager), - UNIT(s)->id, - s->watchdog_usec, - s->type == SERVICE_IDLE ? UNIT(s)->manager->idle_pipe : NULL, + &exec_params, s->exec_runtime, &pid); if (r < 0) |