From: Mike Yuan Date: Tue, 7 May 2024 11:02:32 +0000 (+0800) Subject: core/execute: re-break function declaration of exec_spawn X-Git-Tag: v256-rc2~80^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dddc0602865d82e9b41574d116cc302bb6c0486a;p=thirdparty%2Fsystemd.git core/execute: re-break function declaration of exec_spawn Also rearrange some variable definitions. Note that DECIMAL_STR_MAX() contains the size of NUL byte, so +1 is dropped. --- diff --git a/src/core/execute.c b/src/core/execute.c index 9b953f980fd..09b0c7a6332 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -353,20 +353,18 @@ static void log_command_line(Unit *unit, const char *msg, const char *executable static int exec_context_load_environment(const Unit *unit, const ExecContext *c, char ***l); -int exec_spawn(Unit *unit, - ExecCommand *command, - const ExecContext *context, - ExecParameters *params, - ExecRuntime *runtime, - const CGroupContext *cgroup_context, - PidRef *ret) { - - char serialization_fd_number[DECIMAL_STR_MAX(int) + 1]; +int exec_spawn( + Unit *unit, + ExecCommand *command, + const ExecContext *context, + ExecParameters *params, + ExecRuntime *runtime, + const CGroupContext *cgroup_context, + PidRef *ret) { + _cleanup_free_ char *subcgroup_path = NULL, *max_log_levels = NULL, *executor_path = NULL; - _cleanup_(pidref_done) PidRef pidref = PIDREF_NULL; _cleanup_fdset_free_ FDSet *fdset = NULL; _cleanup_fclose_ FILE *f = NULL; - dual_timestamp start_timestamp; int r; assert(unit); @@ -445,8 +443,12 @@ int exec_spawn(Unit *unit, if (r < 0) return log_unit_error_errno(unit, r, "Failed to get executor path from fd: %m"); + char serialization_fd_number[DECIMAL_STR_MAX(int)]; xsprintf(serialization_fd_number, "%i", fileno(f)); + _cleanup_(pidref_done) PidRef pidref = PIDREF_NULL; + dual_timestamp start_timestamp; + /* Record the start timestamp before we fork so that it is guaranteed to be earlier than the * handoff timestamp. */ dual_timestamp_now(&start_timestamp); diff --git a/src/core/execute.h b/src/core/execute.h index b782967c876..a2e3e57e3b2 100644 --- a/src/core/execute.h +++ b/src/core/execute.h @@ -479,13 +479,14 @@ struct ExecParameters { #include "unit.h" #include "dynamic-user.h" -int exec_spawn(Unit *unit, - ExecCommand *command, - const ExecContext *context, - ExecParameters *exec_params, - ExecRuntime *runtime, - const CGroupContext *cgroup_context, - PidRef *ret); +int exec_spawn( + Unit *unit, + ExecCommand *command, + const ExecContext *context, + ExecParameters *exec_params, + ExecRuntime *runtime, + const CGroupContext *cgroup_context, + PidRef *ret); void exec_command_done(ExecCommand *c); void exec_command_done_array(ExecCommand *c, size_t n);