1
0
mirror of https://github.com/systemd/systemd.git synced 2025-09-02 17:49:53 +03:00

core: move code from execute.c to exec-invoke.c

No functional changes, only moving code that is only needed in
exec_invoke, and adding new dependencies for seccomp/selinux/apparmor/pam
in meson for the sd-executor binary.
This commit is contained in:
Luca Boccassi
2023-09-01 02:24:49 +01:00
parent bb5232b6a3
commit 75689fb2d4
6 changed files with 5126 additions and 5046 deletions

5082
src/core/exec-invoke.c Normal file

File diff suppressed because it is too large Load Diff

16
src/core/exec-invoke.h Normal file
View File

@ -0,0 +1,16 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
typedef struct ExecCommand ExecCommand;
typedef struct ExecContext ExecContext;
typedef struct ExecParameters ExecParameters;
typedef struct ExecRuntime ExecRuntime;
typedef struct CGroupContext CGroupContext;
int exec_invoke(
const ExecCommand *command,
const ExecContext *context,
ExecParameters *params,
ExecRuntime *runtime,
const CGroupContext *cgroup_context,
int *exit_status);

File diff suppressed because it is too large Load Diff

View File

@ -471,13 +471,6 @@ struct ExecParameters {
#include "unit.h"
#include "dynamic-user.h"
int exec_invoke(const ExecCommand *command,
const ExecContext *context,
ExecParameters *params,
ExecRuntime *runtime,
const CGroupContext *cgroup_context,
int *exit_status);
int exec_spawn(Unit *unit,
ExecCommand *command,
const ExecContext *context,
@ -519,6 +512,10 @@ void exec_context_revert_tty(ExecContext *c);
int exec_context_get_clean_directories(ExecContext *c, char **prefix, ExecCleanMask mask, char ***ret);
int exec_context_get_clean_mask(ExecContext *c, ExecCleanMask *ret);
const char *exec_context_tty_path(const ExecContext *context);
int exec_context_tty_size(const ExecContext *context, unsigned *ret_rows, unsigned *ret_cols);
void exec_context_tty_reset(const ExecContext *context, const ExecParameters *p);
void exec_status_start(ExecStatus *s, pid_t pid);
void exec_status_exit(ExecStatus *s, const ExecContext *context, pid_t pid, int code, int status);
void exec_status_dump(const ExecStatus *s, FILE *f, const char *prefix);
@ -541,6 +538,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(ExecRuntime*, exec_runtime_free);
ExecRuntime* exec_runtime_destroy(ExecRuntime *rt);
void exec_runtime_clear(ExecRuntime *rt);
int exec_params_get_cgroup_path(const ExecParameters *params, const CGroupContext *c, char **ret);
void exec_params_clear(ExecParameters *p);
void exec_params_dump(const ExecParameters *p, FILE* f, const char *prefix);
void exec_params_serialized_done(ExecParameters *p);
@ -550,6 +548,7 @@ bool exec_context_get_cpu_affinity_from_numa(const ExecContext *c);
void exec_directory_done(ExecDirectory *d);
int exec_directory_add(ExecDirectory *d, const char *path, const char *symlink);
void exec_directory_sort(ExecDirectory *d);
bool exec_directory_is_private(const ExecContext *context, ExecDirectoryType type);
ExecCleanMask exec_clean_mask_from_string(const char *s);
@ -579,6 +578,7 @@ ExecDirectoryType exec_resource_type_from_string(const char *s) _pure_;
bool exec_needs_mount_namespace(const ExecContext *context, const ExecParameters *params, const ExecRuntime *runtime);
bool exec_needs_network_namespace(const ExecContext *context);
bool exec_needs_ipc_namespace(const ExecContext *context);
/* These logging macros do the same logging as those in unit.h, but using ExecContext and ExecParameters
* instead of the unit object, so that it can be used in the sd-executor context (where the unit object is

View File

@ -7,6 +7,7 @@
#include "alloc-util.h"
#include "build.h"
#include "exec-invoke.h"
#include "execute-serialize.h"
#include "execute.h"
#include "exit-status.h"

View File

@ -146,6 +146,7 @@ systemd_sources = files(
systemd_executor_sources = files(
'executor.c',
'exec-invoke.c',
)
executables += [
@ -169,7 +170,12 @@ executables += [
libcore,
libshared,
],
'dependencies' : libseccomp,
'dependencies' : [
libapparmor,
libpam,
libseccomp,
libselinux,
],
},
fuzz_template + {
'sources' : files('fuzz-unit-file.c'),