1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 10:25:37 +03:00

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.
This commit is contained in:
Mike Yuan 2024-05-07 19:02:32 +08:00
parent 06c0f569e9
commit dddc060286
No known key found for this signature in database
GPG Key ID: 417471C0A40F58B3
2 changed files with 20 additions and 17 deletions

View 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) {
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];
_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);

View 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);