[CRIU] [PATCH v2 16/57] pid: Pass thread pid to caller
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Mar 28 08:36:33 PDT 2017
This is refactoring, no functional changes.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/cr-dump.c | 6 ++++--
criu/include/parasite-syscall.h | 2 +-
criu/parasite-syscall.c | 4 ++--
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 018c61d1..84139fe3 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -823,7 +823,7 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl,
{
struct pid *tid = item->threads[id];
CoreEntry *core = item->core[id];
- pid_t pid = tid->real;
+ pid_t pid = tid->real, parasite_tid;
int ret = -1;
struct cr_img *img;
@@ -831,11 +831,13 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl,
pr_info("Dumping core for thread (pid: %d)\n", pid);
pr_info("----------------------------------------\n");
- ret = parasite_dump_thread_seized(parasite_ctl, item, id, tid, core);
+ ret = parasite_dump_thread_seized(parasite_ctl, item, id, tid, ¶site_tid, core);
if (ret) {
pr_err("Can't dump thread for pid %d\n", pid);
goto err;
}
+ tid->ns[0].virt = parasite_tid;
+
pstree_insert_pid(tid);
img = open_image(CR_FD_CORE, O_DUMP, tid->ns[0].virt);
diff --git a/criu/include/parasite-syscall.h b/criu/include/parasite-syscall.h
index 0f923f38..4ba82082 100644
--- a/criu/include/parasite-syscall.h
+++ b/criu/include/parasite-syscall.h
@@ -33,7 +33,7 @@ extern int parasite_dump_misc_seized(struct parasite_ctl *ctl, struct parasite_d
extern int parasite_dump_creds(struct parasite_ctl *ctl, struct _CredsEntry *ce);
extern int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, const struct pstree_item *item, int pid, struct _CoreEntry *core);
extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, const struct pstree_item *item, int id,
- struct pid *tid, struct _CoreEntry *core);
+ struct pid *tid, pid_t *parasite_tid, struct _CoreEntry *core);
extern int dump_thread_core(int pid, CoreEntry *core,
const struct parasite_dump_thread *dt);
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index 8ec3b727..4f575a76 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -175,7 +175,7 @@ int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, const struct ps
}
int parasite_dump_thread_seized(struct parasite_ctl *ctl, const struct pstree_item *item,
- int id, struct pid *tid, CoreEntry *core)
+ int id, struct pid *tid, pid_t *parasite_tid, CoreEntry *core)
{
struct parasite_dump_thread *args;
pid_t pid = tid->real;
@@ -219,7 +219,7 @@ int parasite_dump_thread_seized(struct parasite_ctl *ctl, const struct pstree_it
compel_release_thread(tctl);
- tid->ns[0].virt = args->tid;
+ *parasite_tid = args->tid;
return dump_thread_core(pid, core, args);
err_rth:
More information about the CRIU
mailing list