From: Daan De Meyer Date: Tue, 8 Oct 2024 14:28:25 +0000 (+0200) Subject: core: Log in more scenarios about which process initiated an operation X-Git-Tag: v257-rc1~285^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F34679%2Fhead;p=thirdparty%2Fsystemd.git core: Log in more scenarios about which process initiated an operation Exit/Reboot/Poweroff and similar operations are invasive enough that logging about who initiated them is very useful to debug issues. --- diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 2ffede9cb8f..d01e972aadc 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -1665,6 +1665,8 @@ static int method_exit(sd_bus_message *message, void *userdata, sd_bus_error *er if (r < 0) return r; + log_caller(message, m, "Exit"); + /* Exit() (in contrast to SetExitCode()) is actually allowed even if * we are running on the host. It will fall back on reboot() in * systemd-shutdown if it cannot do the exit() because it isn't a @@ -1689,6 +1691,8 @@ static int method_reboot(sd_bus_message *message, void *userdata, sd_bus_error * if (r < 0) return r; + log_caller(message, m, "Reboot"); + m->objective = MANAGER_REBOOT; return sd_bus_reply_method_return(message, NULL); @@ -1731,6 +1735,8 @@ static int method_soft_reboot(sd_bus_message *message, void *userdata, sd_bus_er return r; } + log_caller(message, m, "Soft reboot"); + free_and_replace(m->switch_root, rt); m->objective = MANAGER_SOFT_REBOOT; @@ -1751,6 +1757,8 @@ static int method_poweroff(sd_bus_message *message, void *userdata, sd_bus_error if (r < 0) return r; + log_caller(message, m, "Poweroff"); + m->objective = MANAGER_POWEROFF; return sd_bus_reply_method_return(message, NULL); @@ -1770,6 +1778,8 @@ static int method_halt(sd_bus_message *message, void *userdata, sd_bus_error *er if (r < 0) return r; + log_caller(message, m, "Halt"); + m->objective = MANAGER_HALT; return sd_bus_reply_method_return(message, NULL); @@ -1789,6 +1799,8 @@ static int method_kexec(sd_bus_message *message, void *userdata, sd_bus_error *e if (r < 0) return r; + log_caller(message, m, "Kexec"); + m->objective = MANAGER_KEXEC; return sd_bus_reply_method_return(message, NULL);