mirror of
git://github.com/lxc/lxc
synced 2025-08-30 11:31:59 +00:00
start: log signal name and number
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
ea0e384ff5
commit
b0dec2ced0
@ -8,6 +8,7 @@
|
||||
|
||||
#include "error.h"
|
||||
#include "log.h"
|
||||
#include "process_utils.h"
|
||||
|
||||
lxc_log_define(error, lxc);
|
||||
|
||||
@ -28,12 +29,12 @@ int lxc_error_set_and_log(int pid, int status)
|
||||
ret = WEXITSTATUS(status);
|
||||
if (ret)
|
||||
INFO("Child <%d> ended on error (%d)", pid, ret);
|
||||
}
|
||||
|
||||
if (WIFSIGNALED(status)) {
|
||||
int signal = WTERMSIG(status);
|
||||
INFO("Child <%d> ended on signal (%d)", pid, signal);
|
||||
ret = 128 + signal;
|
||||
} else if (WIFSIGNALED(status)) {
|
||||
int signal_nr = WTERMSIG(status);
|
||||
INFO("Child <%d> ended on signal %s(%d)", pid, signal_name(signal_nr), signal_nr);
|
||||
ret = 128 + signal_nr;
|
||||
} else {
|
||||
ERROR("Invalid exit status (%d)", status);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -2098,19 +2098,20 @@ int __lxc_start(struct lxc_handler *handler, struct lxc_operations *ops,
|
||||
* In any case, treat it as a 'halt'.
|
||||
*/
|
||||
if (WIFSIGNALED(status)) {
|
||||
switch(WTERMSIG(status)) {
|
||||
int signal_nr = WTERMSIG(status);
|
||||
switch(signal_nr) {
|
||||
case SIGINT: /* halt */
|
||||
DEBUG("Container \"%s\" is halting", name);
|
||||
DEBUG("%s(%d) - Container \"%s\" is halting", signal_name(signal_nr), signal_nr, name);
|
||||
break;
|
||||
case SIGHUP: /* reboot */
|
||||
DEBUG("Container \"%s\" is rebooting", name);
|
||||
DEBUG("%s(%d) - Container \"%s\" is rebooting", signal_name(signal_nr), signal_nr, name);
|
||||
handler->conf->reboot = REBOOT_REQ;
|
||||
break;
|
||||
case SIGSYS: /* seccomp */
|
||||
DEBUG("Container \"%s\" violated its seccomp policy", name);
|
||||
DEBUG("%s(%d) - Container \"%s\" violated its seccomp policy", signal_name(signal_nr), signal_nr, name);
|
||||
break;
|
||||
default:
|
||||
DEBUG("Unknown exit status for container \"%s\" init %d", name, WTERMSIG(status));
|
||||
DEBUG("%s(%d) - Container \"%s\" init exited", signal_name(signal_nr), signal_nr, name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user