From 9eda83b74aefbcdea5bf8205d1ac77e3af8a7a88 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 2 Aug 2012 07:53:02 +0400 Subject: [PATCH] parasite: Pull cr_options down (or up) to transport sock creation We'll need to check whether the socket is to be created in a net namespace (since we can't detect this automatically yet). Thus the namespaces flags are required there. Signed-off-by: Pavel Emelyanov --- cr-dump.c | 6 +++--- include/parasite-syscall.h | 4 +++- parasite-syscall.c | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cr-dump.c b/cr-dump.c index 039a74ed5..3d9d30d0f 100644 --- a/cr-dump.c +++ b/cr-dump.c @@ -1301,7 +1301,7 @@ static int dump_task_threads(struct parasite_ctl *parasite_ctl, return 0; } -static int dump_one_task(struct pstree_item *item) +static int dump_one_task(struct pstree_item *item, const struct cr_options *o) { pid_t pid = item->pid.real; LIST_HEAD(vma_area_list); @@ -1356,7 +1356,7 @@ static int dump_one_task(struct pstree_item *item) goto err; } - parasite_ctl = parasite_infect_seized(pid, &vma_area_list); + parasite_ctl = parasite_infect_seized(pid, &vma_area_list, o); if (!parasite_ctl) { ret = -1; pr_err("Can't infect (pid: %d) with parasite\n", pid); @@ -1488,7 +1488,7 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts) goto err; for_each_pstree_item(item) { - if (dump_one_task(item)) + if (dump_one_task(item, opts)) goto err; } diff --git a/include/parasite-syscall.h b/include/parasite-syscall.h index 086bd82d1..a091a85da 100644 --- a/include/parasite-syscall.h +++ b/include/parasite-syscall.h @@ -40,7 +40,9 @@ extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid, extern int parasite_drain_fds_seized(struct parasite_ctl *ctl, int *fds, int *lfds, int nr_fds, char *flags); extern int parasite_cure_seized(struct parasite_ctl *ctl); + +struct cr_options; extern struct parasite_ctl *parasite_infect_seized(pid_t pid, - struct list_head *vma_area_list); + struct list_head *vma_area_list, const struct cr_options *); #endif /* PARASITE_SYSCALL_H_ */ diff --git a/parasite-syscall.c b/parasite-syscall.c index bd251703c..85a0d5851 100644 --- a/parasite-syscall.c +++ b/parasite-syscall.c @@ -368,7 +368,7 @@ static int parasite_set_logfd(struct parasite_ctl *ctl, pid_t pid) return 0; } -static int parasite_init(struct parasite_ctl *ctl, pid_t pid) +static int parasite_init(struct parasite_ctl *ctl, pid_t pid, const struct cr_options *o) { struct parasite_init_args args = { }; static int sock = -1; @@ -657,7 +657,8 @@ int parasite_cure_seized(struct parasite_ctl *ctl) return ret; } -struct parasite_ctl *parasite_infect_seized(pid_t pid, struct list_head *vma_area_list) +struct parasite_ctl *parasite_infect_seized(pid_t pid, struct list_head *vma_area_list, + const struct cr_options *o) { struct parasite_ctl *ctl = NULL; struct vma_area *vma_area; @@ -742,7 +743,7 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct list_head *vma_are ctl->addr_cmd = (void *)PARASITE_CMD_ADDR((unsigned long)ctl->local_map); ctl->addr_args = (void *)PARASITE_ARGS_ADDR((unsigned long)ctl->local_map); - ret = parasite_init(ctl, pid); + ret = parasite_init(ctl, pid, o); if (ret) { pr_err("%d: Can't create a transport socket\n", pid); goto err_restore;