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

Andrey Vagin avagin at openvz.org
Thu Nov 19 06:38:19 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         | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/include/proc_parse.h b/include/proc_parse.h
index 4617fe6..123f5db 100644
--- a/include/proc_parse.h
+++ b/include/proc_parse.h
@@ -92,6 +92,7 @@ struct proc_status_creds {
 
 	char			state;
 	int			ppid;
+	unsigned long long	sigpnd;
 
 	int			seccomp_mode;
 	u32			last_filter;
diff --git a/proc_parse.c b/proc_parse.c
index a4cd4f6..7d496f0 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;
@@ -846,9 +848,20 @@ 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;
+			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