[CRIU] [PATCH] criu: use strsignal to describe kill reason

Dmitry Safonov dsafonov at virtuozzo.com
Wed Mar 23 08:25:43 PDT 2016


Where it's possible to use glibc.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/cr-restore.c       | 3 ++-
 criu/cr-service.c       | 4 ++--
 criu/parasite-syscall.c | 3 ++-
 criu/seize.c            | 3 ++-
 criu/util.c             | 3 ++-
 5 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index e79777bae249..593f0b6093fc 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1304,7 +1304,8 @@ err:
 	if (exit)
 		pr_err("%d exited, status=%d\n", pid, status);
 	else
-		pr_err("%d killed by signal %d\n", pid, status);
+		pr_err("%d killed by signal %d: %s\n",
+			pid, status, strsignal(status));
 
 	futex_abort_and_wake(&task_entries->nr_in_progress);
 }
diff --git a/criu/cr-service.c b/criu/cr-service.c
index 88d4af725744..7c67851241b6 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -958,8 +958,8 @@ static void reap_worker(int signo)
 			pr_info("Worker(pid %d) exited with %d\n",
 				pid, WEXITSTATUS(status));
 		else if (WIFSIGNALED(status))
-			pr_info("Worker(pid %d) was killed by %d\n",
-				pid, WTERMSIG(status));
+			pr_info("Worker(pid %d) was killed by %d: %s\n", pid,
+				WTERMSIG(status), strsignal(WTERMSIG(status)));
 	}
 }
 
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index cff5c10e778f..7775ef15a25c 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -403,7 +403,8 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
 	if (WIFEXITED(status))
 		pr_err("%d exited with %d unexpectedly\n", pid, WEXITSTATUS(status));
 	else if (WIFSIGNALED(status))
-		pr_err("%d was killed by %d unexpectedly\n", pid, WTERMSIG(status));
+		pr_err("%d was killed by %d unexpectedly: %s\n",
+			pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
 	else if (WIFSTOPPED(status))
 		pr_err("%d was stopped by %d unexpectedly\n", pid, WSTOPSIG(status));
 
diff --git a/criu/seize.c b/criu/seize.c
index 6dfd08681031..7c46b8932a62 100644
--- a/criu/seize.c
+++ b/criu/seize.c
@@ -446,7 +446,8 @@ static void pstree_wait(struct pstree_item *root_item)
 				break;
 			} else {
 				if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGKILL) {
-					pr_err("Unexpected exit code %d of %d\n", status, pid);
+					pr_err("Unexpected exit code %d of %d: %s\n",
+						status, pid, strsignal(status));
 					BUG();
 				}
 			}
diff --git a/criu/util.c b/criu/util.c
index cbc525d266d5..0148240a80ed 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -670,7 +670,8 @@ out_chld:
 				pr_err("exited, status=%d\n", WEXITSTATUS(status));
 			break;
 		} else if (WIFSIGNALED(status)) {
-			pr_err("killed by signal %d\n", WTERMSIG(status));
+			pr_err("killed by signal %d: %s\n", WTERMSIG(status),
+				strsignal(WTERMSIG(status)));
 			break;
 		} else if (WIFSTOPPED(status)) {
 			pr_err("stopped by signal %d\n", WSTOPSIG(status));
-- 
2.7.2



More information about the CRIU mailing list