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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user