[CRIU] [PATCH 05/17] dump: remove useless arguments from seize_task()

Andrey Vagin avagin at openvz.org
Fri Oct 31 02:14:23 PDT 2014


We get sig and pgid from a parasite, because we need to get
them from a target pid namespace.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 cr-dump.c        | 6 +++---
 cr-exec.c        | 2 +-
 include/ptrace.h | 2 +-
 ptrace.c         | 7 +------
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/cr-dump.c b/cr-dump.c
index a40b5ae..7fd7319 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -817,7 +817,7 @@ static int get_children(struct pstree_item *item)
 			goto free;
 		}
 
-		ret = seize_task(pid, item->pid.real, &item->pgid, &item->sid);
+		ret = seize_task(pid, item->pid.real);
 		if (ret < 0) {
 			/*
 			 * Here is a race window between parse_children() and seize(),
@@ -916,7 +916,7 @@ static int seize_threads(struct pstree_item *item,
 		pr_info("\tSeizing %d's %d thread\n",
 				item->pid.real, pid);
 
-		ret = seize_task(pid, item_ppid(item), NULL, NULL);
+		ret = seize_task(pid, item_ppid(item));
 		if (ret < 0) {
 			/*
 			 * Here is a race window between parse_threads() and seize(),
@@ -1078,7 +1078,7 @@ static int collect_pstree(pid_t pid)
 		return -1;
 
 	root_item->pid.real = pid;
-	ret = seize_task(pid, -1, &root_item->pgid, &root_item->sid);
+	ret = seize_task(pid, -1);
 	if (ret < 0)
 		goto err;
 	pr_info("Seized task %d, state %d\n", pid, ret);
diff --git a/cr-exec.c b/cr-exec.c
index 3623711..9f6ebfe 100644
--- a/cr-exec.c
+++ b/cr-exec.c
@@ -129,7 +129,7 @@ int cr_exec(int pid, char **opt)
 		goto out;
 	}
 
-	prev_state = ret = seize_task(pid, -1, NULL, NULL);
+	prev_state = ret = seize_task(pid, -1);
 	if (ret < 0) {
 		pr_err("Can't seize task %d\n", pid);
 		goto out;
diff --git a/include/ptrace.h b/include/ptrace.h
index ecc63d3..0d89788 100644
--- a/include/ptrace.h
+++ b/include/ptrace.h
@@ -62,7 +62,7 @@ struct ptrace_peeksiginfo_args {
 
 #define SI_EVENT(_si_code)	(((_si_code) & 0xFFFF) >> 8)
 
-extern int seize_task(pid_t pid, pid_t ppid, pid_t *pgid, pid_t *sid);
+extern int seize_task(pid_t pid, pid_t ppid);
 extern int unseize_task(pid_t pid, int orig_state, int state);
 extern int ptrace_peek_area(pid_t pid, void *dst, void *addr, long bytes);
 extern int ptrace_poke_area(pid_t pid, void *src, void *addr, long bytes);
diff --git a/ptrace.c b/ptrace.c
index dc22ee4..dd7f13f 100644
--- a/ptrace.c
+++ b/ptrace.c
@@ -44,7 +44,7 @@ int unseize_task(pid_t pid, int orig_st, int st)
  * up with someone else.
  */
 
-int seize_task(pid_t pid, pid_t ppid, pid_t *pgid, pid_t *sid)
+int seize_task(pid_t pid, pid_t ppid)
 {
 	siginfo_t si;
 	int status;
@@ -82,11 +82,6 @@ int seize_task(pid_t pid, pid_t ppid, pid_t *pgid, pid_t *sid)
 	if (ret2 < 0)
 		return -1;
 
-	if (pgid)
-		*pgid = ps.pgid;
-	if (sid)
-		*sid = ps.sid;
-
 	if (ret < 0) {
 		if (ps.state != 'Z') {
 			if (pid == getpid())
-- 
1.9.3



More information about the CRIU mailing list