]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/execute: re-break function declaration of exec_spawn
authorMike Yuan <me@yhndnzj.com>
Tue, 7 May 2024 11:02:32 +0000 (19:02 +0800)
committerMike Yuan <me@yhndnzj.com>
Tue, 7 May 2024 16:16:54 +0000 (00:16 +0800)
Also rearrange some variable definitions. Note that
DECIMAL_STR_MAX() contains the size of NUL byte,
so +1 is dropped.

src/core/execute.c
src/core/execute.h

index 9b953f980fd08387d22623d2ed59195c81d93e5d..09b0c7a63321b116b5c6233496f1409abba41a08 100644 (file)
@@ -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);
index b782967c8761744ccab3dcd90b228780662c4fb9..a2e3e57e3b20407112f04b99d8b60483417eeb87 100644 (file)
@@ -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);