[CRIU] [PATCH cr] [RFC] pstree: simplify access to pid, real_pid, born_sid

Stanislav Kinsbursky skinsbursky at parallels.com
Fri Jun 1 07:44:37 EDT 2012


01.06.2012 15:39, Andrew Vagin написал:
> On Fri, Jun 01, 2012 at 03:33:56PM +0400, Andrey Vagin wrote:
>>
>> New version of pstree_item looks like:
> Sorry, here is the correct struct pstree_item:
>    struct pstree_item {
>           struct list_head        list;
>           union {
>                  struct pid {
>                          u32 real_pid;
>                          u32 pid;
>                  } cpt_pid;      /* leader pid */
>                  struct {
>                          union {
>                                  u32 born_sid;
>                                  u32 real_pid;
>                          };
>                          u32 pid;
>                  };
>           };
>           struct pstree_item      *parent;
>

OMG...

>> In this case we can use pi->pid instead of pi->pid.pid and so on...
>>
>> Signed-off-by: Andrey Vagin<avagin at openvz.org>
>> ---
>>   cr-dump.c         |   62 +++++++++++++++++++++++++-------------------------
>>   cr-restore.c      |   66 ++++++++++++++++++++++++++--------------------------
>>   cr-show.c         |    8 +++---
>>   files.c           |    4 +-
>>   include/crtools.h |   19 +++++++++------
>>   5 files changed, 81 insertions(+), 78 deletions(-)
>>
>
>> diff --git a/cr-dump.c b/cr-dump.c
>> index 40e0d8c..2065c7c 100644
>> --- a/cr-dump.c
>> +++ b/cr-dump.c
>> @@ -985,7 +985,7 @@ static int parse_threads(const struct pstree_item *item, struct pid **_t, int *_
>>        struct pid *t = NULL;
>>        int nr = 1;
>>
>> -     dir = opendir_proc(item->pid.real_pid, "task");
>> +     dir = opendir_proc(item->real_pid, "task");
>>        if (!dir)
>>                return -1;
>>
>> @@ -1048,7 +1048,7 @@ static int parse_children(const struct pstree_item *item, u32 **_c, int *_n)
>>        int nr = 1, i;
>>
>>        for (i = 0; i<  item->nr_threads; i++) {
>> -             file = fopen_proc(item->pid.real_pid, "task/%d/children",
>> +             file = fopen_proc(item->real_pid, "task/%d/children",
>>                                                item->threads[i].real_pid);
>>                if (!file)
>>                        goto err;
>> @@ -1092,8 +1092,8 @@ struct pstree_item *__alloc_pstree_item(bool rst)
>>        INIT_LIST_HEAD(&item->children);
>>        item->threads = NULL;
>>        item->nr_threads = 0;
>> -     item->pid.pid = -1;
>> -     item->pid.real_pid = -1;
>> +     item->pid = -1;
>> +     item->real_pid = -1;
>>
>>        return item;
>>   }
>> @@ -1114,7 +1114,7 @@ static int get_children(struct pstree_item *item)
>>                        ret = -1;
>>                        goto free;
>>                }
>> -             c->pid.real_pid = ch[i];
>> +             c->real_pid = ch[i];
>>                c->parent = item;
>>                list_add_tail(&c->list,&item->children);
>>        }
>> @@ -1167,7 +1167,7 @@ static void pstree_switch_state(struct pstree_item *root_item, int st)
>>   static pid_t item_ppid(const struct pstree_item *item)
>>   {
>>        item = item->parent;
>> -     return item ? item->pid.real_pid : -1;
>> +     return item ? item->real_pid : -1;
>>   }
>>
>>   static int seize_threads(const struct pstree_item *item)
>> @@ -1181,11 +1181,11 @@ static int seize_threads(const struct pstree_item *item)
>>
>>        for (i = 0; i<  item->nr_threads; i++) {
>>                pid_t pid = item->threads[i].real_pid;
>> -             if (item->pid.real_pid == pid)
>> +             if (item->real_pid == pid)
>>                        continue;
>>
>>                pr_info("\tSeizing %d's %d thread\n",
>> -                             item->pid.real_pid, pid);
>> +                             item->real_pid, pid);
>>                ret = seize_task(pid, item_ppid(item), NULL, NULL);
>>                if (ret<  0)
>>                        goto err;
>> @@ -1205,7 +1205,7 @@ static int seize_threads(const struct pstree_item *item)
>>
>>   err:
>>        for (i--; i>= 0; i--) {
>> -             if (item->pid.real_pid == item->threads[i].real_pid)
>> +             if (item->real_pid == item->threads[i].real_pid)
>>                        continue;
>>
>>                unseize_task(item->threads[i].real_pid, TASK_ALIVE);
>> @@ -1261,20 +1261,20 @@ static int check_xids(struct pstree_item *root_item)
>>                        continue;
>>
>>                /* Easing #1 and #2 for sids */
>> -             if ((p->sid != p->pid.pid)&&  (p->sid != p->parent->sid)) {
>> +             if ((p->sid != p->pid)&&  (p->sid != p->parent->sid)) {
>>                        pr_err("SID mismatch on %d (%d/%d)\n",
>> -                                     p->pid.pid, p->sid, p->parent->sid);
>> +                                     p->pid, p->sid, p->parent->sid);
>>                        return -1;
>>                }
>>
>>                /* Easing #2 for pgids */
>>                for_each_pstree_item(tmp)
>> -                     if (tmp->pid.pid == p->pgid)
>> +                     if (tmp->pid == p->pgid)
>>                                break;
>>
>>                if (tmp == NULL) {
>>                        pr_err("PGIG mismatch on %d (%d)\n",
>> -                                     p->pid.pid, p->pgid);
>> +                                     p->pid, p->pgid);
>>                        return -1;
>>                }
>>        }
>> @@ -1285,7 +1285,7 @@ static int check_xids(struct pstree_item *root_item)
>>   static int collect_task(struct pstree_item *item)
>>   {
>>        int ret;
>> -     pid_t pid = item->pid.real_pid;
>> +     pid_t pid = item->real_pid;
>>
>>        ret = seize_task(pid, item_ppid(item),&item->pgid,&item->sid);
>>        if (ret<  0)
>> @@ -1309,7 +1309,7 @@ static int collect_task(struct pstree_item *item)
>>
>>        close_pid_proc();
>>
>> -     pr_info("Collected %d in %d state\n", item->pid.real_pid, item->state);
>> +     pr_info("Collected %d in %d state\n", item->real_pid, item->state);
>>        return 0;
>>
>>   err_close:
>> @@ -1331,7 +1331,7 @@ static int check_subtree(const struct pstree_item *item)
>>
>>        i = 0;
>>        list_for_each_entry(child,&item->children, list) {
>> -             if (child->pid.real_pid != ch[i])
>> +             if (child->real_pid != ch[i])
>>                        break;
>>                i++;
>>                if (i>  nr)
>> @@ -1350,7 +1350,7 @@ static int check_subtree(const struct pstree_item *item)
>>   static int collect_subtree(struct pstree_item *item, int leader_only)
>>   {
>>        struct pstree_item *child;
>> -     pid_t pid = item->pid.real_pid;
>> +     pid_t pid = item->real_pid;
>>        int ret;
>>
>>        pr_info("Collecting tasks starting from %d\n", pid);
>> @@ -1382,7 +1382,7 @@ static int collect_pstree(pid_t pid, const struct cr_options *opts)
>>                if (root_item == NULL)
>>                        return -1;
>>
>> -             root_item->pid.real_pid = pid;
>> +             root_item->real_pid = pid;
>>                INIT_LIST_HEAD(&root_item->list);
>>
>>                ret = collect_subtree(root_item, opts->leader_only);
>> @@ -1392,7 +1392,7 @@ static int collect_pstree(pid_t pid, const struct cr_options *opts)
>>                         * namespaces' reaper. Check this.
>>                         */
>>                        if (opts->namespaces_flags&  CLONE_NEWPID) {
>> -                             BUG_ON(root_item->pid.real_pid != 1);
>> +                             BUG_ON(root_item->real_pid != 1);
>>
>>                                if (check_subtree(root_item))
>>                                        goto try_again;
>> @@ -1429,7 +1429,7 @@ static int dump_pstree(struct pstree_item *root_item)
>>        int pstree_fd;
>>
>>        pr_info("\n");
>> -     pr_info("Dumping pstree (pid: %d)\n", root_item->pid.real_pid);
>> +     pr_info("Dumping pstree (pid: %d)\n", root_item->real_pid);
>>        pr_info("----------------------------------------\n");
>>
>>        ret = check_xids(root_item);
>> @@ -1441,10 +1441,10 @@ static int dump_pstree(struct pstree_item *root_item)
>>                return -1;
>>
>>        for_each_pstree_item(item) {
>> -             pr_info("Process: %d(%d)\n", item->pid.pid, item->pid.real_pid);
>> +             pr_info("Process: %d(%d)\n", item->pid, item->real_pid);
>>
>> -             e.pid           = item->pid.pid;
>> -             e.ppid          = item->parent ? item->parent->pid.pid : 0;
>> +             e.pid           = item->pid;
>> +             e.ppid          = item->parent ? item->parent->pid : 0;
>>                e.pgid          = item->pgid;
>>                e.sid           = item->sid;
>>                e.nr_threads    = item->nr_threads;
>> @@ -1526,7 +1526,7 @@ static int dump_one_zombie(const struct pstree_item *item,
>>        core->tc.task_state = TASK_DEAD;
>>        core->tc.exit_code = pps->exit_code;
>>
>> -     fd_core = open_image(CR_FD_CORE, O_DUMP, item->pid.pid);
>> +     fd_core = open_image(CR_FD_CORE, O_DUMP, item->pid);
>>        if (fd_core<  0)
>>                goto err_free;
>>
>> @@ -1547,8 +1547,8 @@ static int dump_task_threads(struct parasite_ctl *parasite_ctl,
>>
>>        for (i = 0; i<  item->nr_threads; i++) {
>>                /* Leader is already dumped */
>> -             if (item->pid.real_pid == item->threads[i].real_pid) {
>> -                     item->threads[i].pid = item->pid.pid;
>> +             if (item->real_pid == item->threads[i].real_pid) {
>> +                     item->threads[i].pid = item->pid;
>>                        continue;
>>                }
>>
>> @@ -1561,7 +1561,7 @@ static int dump_task_threads(struct parasite_ctl *parasite_ctl,
>>
>>   static int dump_one_task(struct pstree_item *item)
>>   {
>> -     pid_t pid = item->pid.real_pid;
>> +     pid_t pid = item->real_pid;
>>        LIST_HEAD(vma_area_list);
>>        struct parasite_ctl *parasite_ctl;
>>        int ret = -1;
>> @@ -1591,7 +1591,7 @@ static int dump_one_task(struct pstree_item *item)
>>
>>        if (item->state == TASK_DEAD) {
>>                /* FIXME don't support zombie in pid name space*/
>> -             item->pid.pid = item->pid.real_pid;
>> +             item->pid = item->real_pid;
>>
>>                BUG_ON(!list_empty(&item->children));
>>                return dump_one_zombie(item,&pps_buf);
>> @@ -1622,12 +1622,12 @@ static int dump_one_task(struct pstree_item *item)
>>                goto err_cure_fdset;
>>        }
>>
>> -     item->pid.pid = misc.pid;
>> +     item->pid = misc.pid;
>>        item->sid = misc.sid;
>>        item->pgid = misc.pgid;
>>
>>        ret = -1;
>> -     cr_fdset = cr_task_fdset_open(item->pid.pid, O_DUMP);
>> +     cr_fdset = cr_task_fdset_open(item->pid, O_DUMP);
>>        if (!cr_fdset)
>>                goto err_cure;
>>
>> @@ -1749,7 +1749,7 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
>>                goto err;
>>
>>        if (opts->namespaces_flags)
>> -             if (dump_namespaces(&root_item->pid, opts->namespaces_flags)<  0)
>> +             if (dump_namespaces(&root_item->cpt_pid, opts->namespaces_flags)<  0)
>>                        goto err;
>>
>>        ret = cr_dump_shmem();
>> diff --git a/cr-restore.c b/cr-restore.c
>> index 406c924..5b74c8a 100644
>> --- a/cr-restore.c
>> +++ b/cr-restore.c
>> @@ -101,7 +101,7 @@ static int prepare_pstree(void)
>>                if (pi == NULL)
>>                        break;
>>
>> -             pi->pid.pid = e.pid;
>> +             pi->pid = e.pid;
>>                if (e.pid>  max_pid)
>>                        max_pid = e.pid;
>>
>> @@ -123,18 +123,18 @@ static int prepare_pstree(void)
>>                         * and sit among the last item's ancestors.
>>                         */
>>                        while (parent) {
>> -                             if (parent->pid.pid == e.ppid)
>> +                             if (parent->pid == e.ppid)
>>                                        break;
>>                                parent = parent->parent;
>>                        }
>>
>>                        if (parent == NULL)
>>                                for_each_pstree_item(parent)
>> -                                     if (parent->pid.pid == e.ppid)
>> +                                     if (parent->pid == e.ppid)
>>                                                break;
>>
>>                        if (parent == NULL) {
>> -                             pr_err("Can't find a parent for %d", pi->pid.pid);
>> +                             pr_err("Can't find a parent for %d", pi->pid);
>>                                xfree(pi);
>>                                break;
>>                        }
>> @@ -176,19 +176,19 @@ static int prepare_pstree_ids(void)
>>        LIST_HEAD(helpers);
>>
>>        list_for_each_entry(pi,&root_item->children, list) {
>> -             if (pi->sid == root_item->sid || pi->sid == pi->pid.pid)
>> +             if (pi->sid == root_item->sid || pi->sid == pi->pid)
>>                        continue;
>>
>>                tmp = alloc_pstree_item();
>>                tmp->sid = pi->sid;
>>                tmp->pgid = pi->sid;
>> -             tmp->pid.pid = pi->sid;
>> +             tmp->pid = pi->sid;
>>                tmp->state = TASK_HELPER;
>>                tmp->parent = root_item;
>>                list_add_tail(&tmp->list,&helpers);
>>
>>                pr_info("Add a helper %d for restoring SID %d\n",
>> -                             tmp->pid.pid, tmp->sid);
>> +                             tmp->pid, tmp->sid);
>>
>>                ci = list_entry(pi->list.prev, struct pstree_item, list);
>>                pi = ci;
>> @@ -196,11 +196,11 @@ static int prepare_pstree_ids(void)
>>                list_for_each_entry_safe_continue(ci, t,&root_item->children, list) {
>>                        if (ci->sid != tmp->sid)
>>                                continue;
>> -                     if (ci->sid == ci->pid.pid)
>> +                     if (ci->sid == ci->pid)
>>                                continue;
>>
>>                        pr_info("Attach %d to the temporary task %d\n",
>> -                             ci->pid.pid, tmp->pid.pid);
>> +                             ci->pid, tmp->pid);
>>
>>                        ci->parent = tmp;
>>                        list_move(&ci->list,&tmp->children);
>> @@ -215,16 +215,16 @@ static int prepare_pstree_ids(void)
>>                if (pi->state == TASK_HELPER)
>>                        continue;
>>
>> -             if (pi->sid != pi->pid.pid) {
>> +             if (pi->sid != pi->pid) {
>>
>>                        if (pi->parent->sid == pi->sid)
>>                                continue;
>>
>>                        /* the task can for a child before and after setsid() */
>>                        ci = pi->parent;
>> -                     while (ci&&  ci->pid.pid != pi->sid) {
>> +                     while (ci&&  ci->pid != pi->sid) {
>>                                ci->born_sid = pi->sid;
>> -                             pr_info("%d was born with sid %d\n", ci->pid.pid, pi->sid);
>> +                             pr_info("%d was born with sid %d\n", ci->pid, pi->sid);
>>                                ci = ci->parent;
>>                        }
>>
>> @@ -245,12 +245,12 @@ static int prepare_pstree_ids(void)
>>                                continue;
>>
>>                        ci->pgid = pi->pgid;
>> -                     ci->pid.pid = ++max_pid;
>> +                     ci->pid = ++max_pid;
>>                        ci->parent = pi;
>>                        list_move(&ci->list,&pi->children);
>>
>>                        pr_info("Attach %d to the task %d\n",
>> -                                     ci->pid.pid, pi->pid.pid);
>> +                                     ci->pid, pi->pid);
>>
>>                        break;
>>                }
>> @@ -299,11 +299,11 @@ static int prepare_shared(void)
>>                return -1;
>>
>>        for_each_pstree_item(pi) {
>> -             ret = prepare_shmem_pid(pi->pid.pid);
>> +             ret = prepare_shmem_pid(pi->pid);
>>                if (ret<  0)
>>                        break;
>>
>> -             ret = prepare_fd_pid(pi->pid.pid, pi->rst);
>> +             ret = prepare_fd_pid(pi->pid, pi->rst);
>>                if (ret<  0)
>>                        break;
>>        }
>> @@ -439,14 +439,14 @@ static int restore_one_alive_task(int pid)
>>                if (pi->state != TASK_HELPER)
>>                        continue;
>>
>> -             ret = waitpid(pi->pid.pid,&status, 0);
>> +             ret = waitpid(pi->pid,&status, 0);
>>                if (ret == -1) {
>> -                     pr_err("waitpid(%d) failed\n", pi->pid.pid);
>> +                     pr_err("waitpid(%d) failed\n", pi->pid);
>>                        return -1;
>>                }
>>
>>                if (!WIFEXITED(status) || WEXITSTATUS(status)) {
>> -                     pr_err("%d exited with non-zero code (%d,%d)", pi->pid.pid,
>> +                     pr_err("%d exited with non-zero code (%d,%d)", pi->pid,
>>                                WEXITSTATUS(status), WTERMSIG(status));
>>                        return -1;
>>                }
>> @@ -625,7 +625,7 @@ static inline int fork_with_pid(struct pstree_item *item, unsigned long ns_clone
>>        char buf[32];
>>        struct cr_clone_arg ca;
>>        void *stack;
>> -     pid_t pid = item->pid.pid;
>> +     pid_t pid = item->pid;
>>
>>        pr_info("Forking task with %d pid (flags 0x%lx)\n", pid, ns_clone_flags);
>>
>> @@ -681,7 +681,7 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
>>        list_for_each_entry(pi,&me->children, list) {
>>                if (pi->state != TASK_HELPER)
>>                        continue;
>> -             if (pi->pid.pid == siginfo->si_pid)
>> +             if (pi->pid == siginfo->si_pid)
>>                        return;
>>        }
>>
>> @@ -718,8 +718,8 @@ static void restore_sid(void)
>>         * we can call setpgid() on custom values.
>>         */
>>
>> -     if (me->pid.pid == me->sid) {
>> -             pr_info("Restoring %d to %d sid\n", me->pid.pid, me->sid);
>> +     if (me->pid == me->sid) {
>> +             pr_info("Restoring %d to %d sid\n", me->pid, me->sid);
>>                sid = setsid();
>>                if (sid != me->sid) {
>>                        pr_perror("Can't restore sid (%d)", sid);
>> @@ -739,7 +739,7 @@ static void restore_pgid(void)
>>   {
>>        pid_t pgid;
>>
>> -     pr_info("Restoring %d to %d pgid\n", me->pid.pid, me->pgid);
>> +     pr_info("Restoring %d to %d pgid\n", me->pid, me->pgid);
>>
>>        pgid = getpgrp();
>>        if (me->pgid == pgid)
>> @@ -747,7 +747,7 @@ static void restore_pgid(void)
>>
>>        pr_info("\twill call setpgid, mine pgid is %d\n", pgid);
>>        if (setpgid(0, me->pgid) != 0) {
>> -             pr_perror("Can't restore pgid (%d/%d->%d)", me->pid.pid, pgid, me->pgid);
>> +             pr_perror("Can't restore pgid (%d/%d->%d)", me->pid, pgid, me->pgid);
>>                xid_fail();
>>        }
>>   }
>> @@ -777,8 +777,8 @@ static int restore_task_with_children(void *_arg)
>>        me = ca->item;
>>
>>        pid = getpid();
>> -     if (me->pid.pid != pid) {
>> -             pr_err("Pid %d do not match expected %d\n", pid, me->pid.pid);
>> +     if (me->pid != pid) {
>> +             pr_err("Pid %d do not match expected %d\n", pid, me->pid);
>>                exit(-1);
>>        }
>>
>> @@ -796,7 +796,7 @@ static int restore_task_with_children(void *_arg)
>>                exit(1);
>>
>>        if (ca->clone_flags) {
>> -             ret = prepare_namespace(me->pid.pid, ca->clone_flags);
>> +             ret = prepare_namespace(me->pid, ca->clone_flags);
>>                if (ret)
>>                        exit(-1);
>>        }
>> @@ -810,7 +810,7 @@ static int restore_task_with_children(void *_arg)
>>        sigdelset(&blockmask, SIGCHLD);
>>        ret = sigprocmask(SIG_BLOCK,&blockmask, NULL);
>>        if (ret) {
>> -             pr_perror("%d: Can't block signals", me->pid.pid);
>> +             pr_perror("%d: Can't block signals", me->pid);
>>                exit(1);
>>        }
>>
>> @@ -844,7 +844,7 @@ static int restore_task_with_children(void *_arg)
>>
>>        restore_pgid();
>>
>> -     return restore_one_task(me->pid.pid);
>> +     return restore_one_task(me->pid);
>>   }
>>
>>   static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
>> @@ -873,7 +873,7 @@ static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
>>         * this later.
>>         */
>>
>> -     if (init->pid.pid == 1) {
>> +     if (init->pid == 1) {
>>                sprintf(proc_mountpoint, "/tmp/crtools-proc.XXXXXX");
>>                if (mkdtemp(proc_mountpoint) == NULL) {
>>                        pr_err("mkdtemp failed %m");
>> @@ -903,7 +903,7 @@ static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
>>        ret = (int)futex_get(&task_entries->nr_in_progress);
>>
>>   out:
>> -     if (init->pid.pid == 1) {
>> +     if (init->pid == 1) {
>>                int err;
>>                err = umount(proc_mountpoint);
>>                if (err == -1)
>> @@ -918,7 +918,7 @@ out:
>>                pr_err("Someone can't be restored\n");
>>
>>                for_each_pstree_item(pi)
>> -                     kill(pi->pid.pid, SIGKILL);
>> +                     kill(pi->pid, SIGKILL);
>>
>>                return 1;
>>        }
>> diff --git a/cr-show.c b/cr-show.c
>> index f697bcc..973429c 100644
>> --- a/cr-show.c
>> +++ b/cr-show.c
>> @@ -426,7 +426,7 @@ static int show_collect_pstree(int fd_pstree, struct list_head *collect)
>>                        if (!item)
>>                                return -1;
>>
>> -                     item->pid.pid = e.pid;
>> +                     item->pid = e.pid;
>>                        item->nr_threads = e.nr_threads;
>>                        item->threads = xzalloc(sizeof(u32) * e.nr_threads);
>>                        if (!item->threads) {
>> @@ -649,7 +649,7 @@ static int cr_show_all(struct cr_options *opts)
>>        show_sk_queues(fd, opts);
>>        close(fd);
>>
>> -     pid = list_first_entry(&pstree_list, struct pstree_item, list)->pid.pid;
>> +     pid = list_first_entry(&pstree_list, struct pstree_item, list)->pid;
>>        ret = try_show_namespaces(pid, opts);
>>        if (ret)
>>                goto out;
>> @@ -657,7 +657,7 @@ static int cr_show_all(struct cr_options *opts)
>>        list_for_each_entry(item,&pstree_list, list) {
>>                struct cr_fdset *cr_fdset = NULL;
>>
>> -             cr_fdset = cr_task_fdset_open(item->pid.pid, O_SHOW);
>> +             cr_fdset = cr_task_fdset_open(item->pid, O_SHOW);
>>                if (!cr_fdset)
>>                        goto out;
>>
>> @@ -668,7 +668,7 @@ static int cr_show_all(struct cr_options *opts)
>>
>>                        for (i = 0; i<  item->nr_threads; i++) {
>>
>> -                             if (item->threads[i].pid == item->pid.pid)
>> +                             if (item->threads[i].pid == item->pid)
>>                                        continue;
>>
>>                                fd_th = open_image_ro(CR_FD_CORE, item->threads[i]);
>> diff --git a/files.c b/files.c
>> index f30aee1..599281b 100644
>> --- a/files.c
>> +++ b/files.c
>> @@ -663,7 +663,7 @@ int prepare_fds(struct pstree_item *me)
>>
>>        for (state = 0; state<  FD_STATE_MAX; state++) {
>>                list_for_each_entry(fle,&me->rst->fds, ps_list) {
>> -                     ret = open_fdinfo(me->pid.pid,&fle->fe, state);
>> +                     ret = open_fdinfo(me->pid,&fle->fe, state);
>>                        if (ret)
>>                                goto done;
>>                }
>> @@ -674,7 +674,7 @@ int prepare_fds(struct pstree_item *me)
>>                 * list and restore at the very end.
>>                 */
>>                list_for_each_entry(fle,&me->rst->eventpoll, ps_list) {
>> -                     ret = open_fdinfo(me->pid.pid,&fle->fe, state);
>> +                     ret = open_fdinfo(me->pid,&fle->fe, state);
>>                        if (ret)
>>                                goto done;
>>                }
>> diff --git a/include/crtools.h b/include/crtools.h
>> index 9b4d71a..a88ea0a 100644
>> --- a/include/crtools.h
>> +++ b/include/crtools.h
>> @@ -175,17 +175,20 @@ struct rst_info {
>>        struct list_head        eventpoll;
>>   };
>>
>> -struct pid
>> -{
>> -     u32 real_pid;
>> -     u32 pid;
>> -};
>> -
>>   struct pstree_item {
>>        struct list_head        list;
>>        union {
>> -             struct pid      pid;            /* leader pid */
>> -             u32 born_sid;
>> +             struct pid {
>> +                     u32 real_pid;
>> +                     u32 pid;
>> +             } cpt_pid;      /* leader pid */
>> +             struct {
>> +                     union {
>> +                             u32 born_sid;
>> +                             u32 real_pid;
>> +                     };
>> +                     u32 pid;
>> +             };
>>        };
>>        struct pstree_item      *parent;
>>        struct list_head        children;       /* array of children */
>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://openvz.org/mailman/listinfo/criu
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://openvz.org/mailman/listinfo/criu


-- 
Best regards,
Stanislav Kinsbursky



More information about the CRIU mailing list