[CRIU] [PATCH 1/2] proc_parse: parse pending signals

Andrey Vagin avagin at openvz.org
Sun Nov 15 04:08:13 PST 2015


From: Andrew Vagin <avagin at virtuozzo.com>

It's required to check the SIGSTOP signal, which can't be blocked.

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 include/proc_parse.h |  1 +
 proc_parse.c         | 19 +++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/include/proc_parse.h b/include/proc_parse.h
index 92fc477..80a728b 100644
--- a/include/proc_parse.h
+++ b/include/proc_parse.h
@@ -85,6 +85,7 @@ struct proc_status_creds {
 
 	char			state;
 	int			ppid;
+	unsigned long long	sigpnd;
 
 	int			seccomp_mode;
 };
diff --git a/proc_parse.c b/proc_parse.c
index 65d1338..52803a6 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -765,10 +765,12 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
 		return -1;
 	}
 
+	cr->sigpnd = 0;
+
 	if (bfdopenr(&f))
 		return -1;
 
-	while (done < 9) {
+	while (done < 11) {
 		str = breadline(&f);
 		if (str == NULL)
 			break;
@@ -851,9 +853,22 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
 			done++;
 			continue;
 		}
+
+		if (!strncmp(str, "SigPnd:", 7) || !strncmp(str, "ShdPnd:", 7)) {
+			unsigned long long sigpnd;
+
+			if (sscanf(str + 7, "%llx", &sigpnd) != 1)
+				goto err_parse;
+			if (sigpnd != 0)
+				pr_err("%llx\n", sigpnd);
+			cr->sigpnd |= sigpnd;
+
+			done++;
+			continue;
+		}
 	}
 
-	if (done >= 8)
+	if (done >= 10)
 		ret = 0;
 
 err_parse:
-- 
2.4.3



More information about the CRIU mailing list