diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-02-06 16:00:34 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-02-06 16:00:34 +0900 |
commit | e8a565cb660a7a11f76180fe441ba8e4f9383771 (patch) | |
tree | 05ca214885360c1c25787877b04e565cab785143 /src/core/execute.h | |
parent | 960c7c2791cbf69d57fdcfccfc25ca140933c549 (diff) | |
download | systemd-e8a565cb660a7a11f76180fe441ba8e4f9383771.tar.gz |
core: make ExecRuntime be manager managed object
Before this, each ExecRuntime object is owned by a unit. However,
it may be shared with other units which enable JoinsNamespaceOf=.
Thus, by the serialization/deserialization process, its sharing
information, more specifically, reference counter is lost, and
causes issue #7790.
This makes ExecRuntime objects be managed by manager, and changes
the serialization/deserialization process.
Fixes #7790.
Diffstat (limited to 'src/core/execute.h')
-rw-r--r-- | src/core/execute.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/core/execute.h b/src/core/execute.h index d04dfcf6c9..90d0fc64e3 100644 --- a/src/core/execute.h +++ b/src/core/execute.h @@ -25,6 +25,7 @@ typedef struct ExecCommand ExecCommand; typedef struct ExecContext ExecContext; typedef struct ExecRuntime ExecRuntime; typedef struct ExecParameters ExecParameters; +typedef struct Manager Manager; #include <sched.h> #include <stdbool.h> @@ -120,6 +121,11 @@ struct ExecCommand { struct ExecRuntime { int n_ref; + Manager *manager; + + /* unit id of the owner */ + char *id; + char *tmp_dir; char *var_tmp_dir; @@ -374,14 +380,13 @@ void exec_status_start(ExecStatus *s, pid_t pid); void exec_status_exit(ExecStatus *s, ExecContext *context, pid_t pid, int code, int status); void exec_status_dump(ExecStatus *s, FILE *f, const char *prefix); -int exec_runtime_make(ExecRuntime **rt, ExecContext *c, const char *id); -ExecRuntime *exec_runtime_ref(ExecRuntime *r); -ExecRuntime *exec_runtime_unref(ExecRuntime *r); - -int exec_runtime_serialize(Unit *unit, ExecRuntime *rt, FILE *f, FDSet *fds); -int exec_runtime_deserialize_item(Unit *unit, ExecRuntime **rt, const char *key, const char *value, FDSet *fds); +int exec_runtime_acquire(Manager *m, const ExecContext *c, const char *name, bool create, ExecRuntime **ret); +ExecRuntime *exec_runtime_unref(ExecRuntime *r, bool destroy); -void exec_runtime_destroy(ExecRuntime *rt); +int exec_runtime_serialize(const Manager *m, FILE *f, FDSet *fds); +int exec_runtime_deserialize_compat(Unit *u, const char *key, const char *value, FDSet *fds); +void exec_runtime_deserialize_one(Manager *m, const char *value, FDSet *fds); +void exec_runtime_vacuum(Manager *m); const char* exec_output_to_string(ExecOutput i) _const_; ExecOutput exec_output_from_string(const char *s) _pure_; |