From: Lennart Poettering Date: Wed, 24 Apr 2024 09:10:50 +0000 (+0200) Subject: mount,swap: include ExecStatus output in dump X-Git-Tag: v256-rc1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9e4d9ba958525c910244a12f01d76dbf3760af9;p=thirdparty%2Fsystemd.git mount,swap: include ExecStatus output in dump socket and service units output there ExecCommand/ExecStatus definitions already, but this was missing in mount/swap. Fix that. --- diff --git a/src/core/execute.c b/src/core/execute.c index cab74fdcc10..26a4bf1b6f5 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -1881,7 +1881,7 @@ void exec_status_dump(const ExecStatus *s, FILE *f, const char *prefix) { prefix, s->status); } -static void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) { +void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) { _cleanup_free_ char *cmd = NULL; const char *prefix2; diff --git a/src/core/execute.h b/src/core/execute.h index acca6e3152d..f6595cf93e1 100644 --- a/src/core/execute.h +++ b/src/core/execute.h @@ -497,6 +497,7 @@ void exec_command_free_array(ExecCommand **c, size_t n); void exec_command_reset_status_array(ExecCommand *c, size_t n); void exec_command_reset_status_list_array(ExecCommand **c, size_t n); +void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix); void exec_command_dump_list(ExecCommand *c, FILE *f, const char *prefix); void exec_command_append_list(ExecCommand **l, ExecCommand *e); int exec_command_set(ExecCommand *c, const char *path, ...) _sentinel_; diff --git a/src/core/mount.c b/src/core/mount.c index 886ef8974cb..d70a60b3774 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -810,9 +810,13 @@ static void mount_catchup(Unit *u) { static void mount_dump(Unit *u, FILE *f, const char *prefix) { Mount *m = ASSERT_PTR(MOUNT(u)); MountParameters *p; + const char *prefix2; assert(f); + prefix = strempty(prefix); + prefix2 = strjoina(prefix, "\t"); + p = get_mount_parameters(m); fprintf(f, @@ -857,6 +861,16 @@ static void mount_dump(Unit *u, FILE *f, const char *prefix) { exec_context_dump(&m->exec_context, f, prefix); kill_context_dump(&m->kill_context, f, prefix); cgroup_context_dump(UNIT(m), f, prefix); + + for (MountExecCommand c = 0; c < _MOUNT_EXEC_COMMAND_MAX; c++) { + if (!m->exec_command[c].argv) + continue; + + fprintf(f, "%s%s %s:\n", + prefix, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), mount_exec_command_to_string(c)); + + exec_command_dump(m->exec_command + c, f, prefix2); + } } static int mount_spawn(Mount *m, ExecCommand *c, PidRef *ret_pid) { diff --git a/src/core/swap.c b/src/core/swap.c index 820dfdff81c..3d202607287 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -560,9 +560,13 @@ static int swap_coldplug(Unit *u) { static void swap_dump(Unit *u, FILE *f, const char *prefix) { Swap *s = ASSERT_PTR(SWAP(u)); SwapParameters *p; + const char *prefix2; assert(f); + prefix = strempty(prefix); + prefix2 = strjoina(prefix, "\t"); + if (s->from_proc_swaps) p = &s->parameters_proc_swaps; else if (s->from_fragment) @@ -608,6 +612,17 @@ static void swap_dump(Unit *u, FILE *f, const char *prefix) { exec_context_dump(&s->exec_context, f, prefix); kill_context_dump(&s->kill_context, f, prefix); cgroup_context_dump(UNIT(s), f, prefix); + + for (SwapExecCommand c = 0; c < _SWAP_EXEC_COMMAND_MAX; c++) { + if (!s->exec_command[c].argv) + continue; + + fprintf(f, "%s%s %s:\n", + prefix, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), swap_exec_command_to_string(c)); + + exec_command_dump(s->exec_command + c, f, prefix2); + } + } static int swap_spawn(Swap *s, ExecCommand *c, PidRef *ret_pid) {