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.
This commit is contained in:
Lennart Poettering
2024-04-24 21:23:42 +02:00
committed by Luca Boccassi
parent 2fcf8bf3b1
commit b9e4d9ba95
4 changed files with 31 additions and 1 deletions
+1 -1
View File
@@ -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;
+1
View File
@@ -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_;
+14
View File
@@ -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) {
+15
View File
@@ -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) {