Commit 9eda83b7 authored by Pavel Emelyanov's avatar Pavel Emelyanov

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: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 38431fb1
...@@ -1301,7 +1301,7 @@ static int dump_task_threads(struct parasite_ctl *parasite_ctl, ...@@ -1301,7 +1301,7 @@ static int dump_task_threads(struct parasite_ctl *parasite_ctl,
return 0; 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; pid_t pid = item->pid.real;
LIST_HEAD(vma_area_list); LIST_HEAD(vma_area_list);
...@@ -1356,7 +1356,7 @@ static int dump_one_task(struct pstree_item *item) ...@@ -1356,7 +1356,7 @@ static int dump_one_task(struct pstree_item *item)
goto err; goto err;
} }
parasite_ctl = parasite_infect_seized(pid, &vma_area_list); parasite_ctl = parasite_infect_seized(pid, &vma_area_list, o);
if (!parasite_ctl) { if (!parasite_ctl) {
ret = -1; ret = -1;
pr_err("Can't infect (pid: %d) with parasite\n", pid); 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) ...@@ -1488,7 +1488,7 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
goto err; goto err;
for_each_pstree_item(item) { for_each_pstree_item(item) {
if (dump_one_task(item)) if (dump_one_task(item, opts))
goto err; goto err;
} }
......
...@@ -40,7 +40,9 @@ extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid, ...@@ -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_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); extern int parasite_cure_seized(struct parasite_ctl *ctl);
struct cr_options;
extern struct parasite_ctl *parasite_infect_seized(pid_t pid, 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_ */ #endif /* PARASITE_SYSCALL_H_ */
...@@ -368,7 +368,7 @@ static int parasite_set_logfd(struct parasite_ctl *ctl, pid_t pid) ...@@ -368,7 +368,7 @@ static int parasite_set_logfd(struct parasite_ctl *ctl, pid_t pid)
return 0; 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 = { }; struct parasite_init_args args = { };
static int sock = -1; static int sock = -1;
...@@ -657,7 +657,8 @@ int parasite_cure_seized(struct parasite_ctl *ctl) ...@@ -657,7 +657,8 @@ int parasite_cure_seized(struct parasite_ctl *ctl)
return ret; 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 parasite_ctl *ctl = NULL;
struct vma_area *vma_area; struct vma_area *vma_area;
...@@ -742,7 +743,7 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct list_head *vma_are ...@@ -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_cmd = (void *)PARASITE_CMD_ADDR((unsigned long)ctl->local_map);
ctl->addr_args = (void *)PARASITE_ARGS_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) { if (ret) {
pr_err("%d: Can't create a transport socket\n", pid); pr_err("%d: Can't create a transport socket\n", pid);
goto err_restore; goto err_restore;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment