mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-21 09:10:10 +00:00
pstree: Rename @list member to @sibling
To be close to the kernel naming. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
9c60b1f4ad
commit
17a1548a5b
5 changed files with 32 additions and 32 deletions
12
cr-dump.c
12
cr-dump.c
|
|
@ -1025,7 +1025,7 @@ static int get_children(struct pstree_item *item)
|
|||
}
|
||||
c->pid.real = ch[i];
|
||||
c->parent = item;
|
||||
list_add_tail(&c->list, &item->children);
|
||||
list_add_tail(&c->sibling, &item->children);
|
||||
}
|
||||
free:
|
||||
xfree(ch);
|
||||
|
|
@ -1160,7 +1160,7 @@ static int check_subtree(const struct pstree_item *item)
|
|||
return ret;
|
||||
|
||||
i = 0;
|
||||
list_for_each_entry(child, &item->children, list) {
|
||||
list_for_each_entry(child, &item->children, sibling) {
|
||||
if (child->pid.real != ch[i])
|
||||
break;
|
||||
i++;
|
||||
|
|
@ -1188,7 +1188,7 @@ static int collect_subtree(struct pstree_item *item)
|
|||
if (ret)
|
||||
return -1;
|
||||
|
||||
list_for_each_entry(child, &item->children, list) {
|
||||
list_for_each_entry(child, &item->children, sibling) {
|
||||
ret = collect_subtree(child);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
|
@ -1210,7 +1210,7 @@ static int collect_pstree(pid_t pid, const struct cr_options *opts)
|
|||
return -1;
|
||||
|
||||
root_item->pid.real = pid;
|
||||
INIT_LIST_HEAD(&root_item->list);
|
||||
INIT_LIST_HEAD(&root_item->sibling);
|
||||
|
||||
ret = collect_subtree(root_item);
|
||||
if (ret == 0) {
|
||||
|
|
@ -1348,7 +1348,7 @@ static int fill_zombies_pids(struct pstree_item *item)
|
|||
if (parse_children(item->pid.virt, &ch, &nr) < 0)
|
||||
return -1;
|
||||
|
||||
list_for_each_entry(child, &item->children, list) {
|
||||
list_for_each_entry(child, &item->children, sibling) {
|
||||
if (child->pid.virt < 0)
|
||||
continue;
|
||||
for (i = 0; i < nr; i++) {
|
||||
|
|
@ -1360,7 +1360,7 @@ static int fill_zombies_pids(struct pstree_item *item)
|
|||
}
|
||||
|
||||
i = 0;
|
||||
list_for_each_entry(child, &item->children, list) {
|
||||
list_for_each_entry(child, &item->children, sibling) {
|
||||
if (child->pid.virt > 0)
|
||||
continue;
|
||||
for (; i < nr; i++) {
|
||||
|
|
|
|||
10
cr-restore.c
10
cr-restore.c
|
|
@ -296,7 +296,7 @@ static int pstree_wait_helpers()
|
|||
{
|
||||
struct pstree_item *pi;
|
||||
|
||||
list_for_each_entry(pi, ¤t->children, list) {
|
||||
list_for_each_entry(pi, ¤t->children, sibling) {
|
||||
int status, ret;
|
||||
|
||||
if (pi->state != TASK_HELPER)
|
||||
|
|
@ -617,14 +617,14 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
|
|||
if (status)
|
||||
break;
|
||||
|
||||
list_for_each_entry(pi, ¤t->children, list) {
|
||||
list_for_each_entry(pi, ¤t->children, sibling) {
|
||||
if (pi->state != TASK_HELPER)
|
||||
continue;
|
||||
if (pi->pid.virt == siginfo->si_pid)
|
||||
break;
|
||||
}
|
||||
|
||||
if (&pi->list == ¤t->children)
|
||||
if (&pi->sibling == ¤t->children)
|
||||
break; /* The process is not a helper */
|
||||
}
|
||||
|
||||
|
|
@ -787,7 +787,7 @@ static int restore_task_with_children(void *_arg)
|
|||
}
|
||||
|
||||
pr_info("Restoring children:\n");
|
||||
list_for_each_entry(child, ¤t->children, list) {
|
||||
list_for_each_entry(child, ¤t->children, sibling) {
|
||||
if (!restore_before_setsid(child))
|
||||
continue;
|
||||
|
||||
|
|
@ -801,7 +801,7 @@ static int restore_task_with_children(void *_arg)
|
|||
restore_sid();
|
||||
|
||||
pr_info("Restoring children:\n");
|
||||
list_for_each_entry(child, ¤t->children, list) {
|
||||
list_for_each_entry(child, ¤t->children, sibling) {
|
||||
if (restore_before_setsid(child))
|
||||
continue;
|
||||
ret = fork_with_pid(child, 0);
|
||||
|
|
|
|||
10
cr-show.c
10
cr-show.c
|
|
@ -289,7 +289,7 @@ static void pstree_handler(int fd, void *obj, int collect)
|
|||
return;
|
||||
}
|
||||
|
||||
list_add_tail(&item->list, &pstree_list);
|
||||
list_add_tail(&item->sibling, &pstree_list);
|
||||
}
|
||||
|
||||
void show_collect_pstree(int fd, int collect)
|
||||
|
|
@ -445,12 +445,12 @@ 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.virt;
|
||||
pid = list_first_entry(&pstree_list, struct pstree_item, sibling)->pid.virt;
|
||||
ret = try_show_namespaces(pid, opts);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
list_for_each_entry(item, &pstree_list, list) {
|
||||
list_for_each_entry(item, &pstree_list, sibling) {
|
||||
struct cr_fdset *cr_fdset = NULL;
|
||||
|
||||
cr_fdset = cr_task_fdset_open(item->pid.virt, O_SHOW);
|
||||
|
|
@ -490,8 +490,8 @@ static int cr_show_all(struct cr_options *opts)
|
|||
}
|
||||
|
||||
out:
|
||||
list_for_each_entry_safe(item, tmp, &pstree_list, list) {
|
||||
list_del(&item->list);
|
||||
list_for_each_entry_safe(item, tmp, &pstree_list, sibling) {
|
||||
list_del(&item->sibling);
|
||||
xfree(item->threads);
|
||||
xfree(item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
struct pstree_item {
|
||||
struct pstree_item *parent;
|
||||
struct list_head children; /* list of my children */
|
||||
struct list_head list; /* linkage in my parent's children list */
|
||||
struct list_head sibling; /* linkage in my parent's children list */
|
||||
|
||||
struct pid pid;
|
||||
pid_t pgid;
|
||||
|
|
|
|||
30
pstree.c
30
pstree.c
|
|
@ -17,12 +17,12 @@ void free_pstree(struct pstree_item *root_item)
|
|||
|
||||
while (item) {
|
||||
if (!list_empty(&item->children)) {
|
||||
item = list_first_entry(&item->children, struct pstree_item, list);
|
||||
item = list_first_entry(&item->children, struct pstree_item, sibling);
|
||||
continue;
|
||||
}
|
||||
|
||||
parent = item->parent;
|
||||
list_del(&item->list);
|
||||
list_del(&item->sibling);
|
||||
xfree(item->threads);
|
||||
xfree(item);
|
||||
item = parent;
|
||||
|
|
@ -38,7 +38,7 @@ struct pstree_item *__alloc_pstree_item(bool rst)
|
|||
return NULL;
|
||||
|
||||
INIT_LIST_HEAD(&item->children);
|
||||
INIT_LIST_HEAD(&item->list);
|
||||
INIT_LIST_HEAD(&item->sibling);
|
||||
|
||||
item->pid.virt = -1;
|
||||
item->pid.real = -1;
|
||||
|
|
@ -51,11 +51,11 @@ struct pstree_item *__alloc_pstree_item(bool rst)
|
|||
struct pstree_item *pstree_item_next(struct pstree_item *item)
|
||||
{
|
||||
if (!list_empty(&item->children))
|
||||
return list_first_entry(&item->children, struct pstree_item, list);
|
||||
return list_first_entry(&item->children, struct pstree_item, sibling);
|
||||
|
||||
while (item->parent) {
|
||||
if (item->list.next != &item->parent->children)
|
||||
return list_entry(item->list.next, struct pstree_item, list);
|
||||
if (item->sibling.next != &item->parent->children)
|
||||
return list_entry(item->sibling.next, struct pstree_item, sibling);
|
||||
item = item->parent;
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ int prepare_pstree(void)
|
|||
}
|
||||
|
||||
pi->parent = parent;
|
||||
list_add(&pi->list, &parent->children);
|
||||
list_add(&pi->sibling, &parent->children);
|
||||
}
|
||||
|
||||
parent = pi;
|
||||
|
|
@ -211,7 +211,7 @@ int prepare_pstree_ids(void)
|
|||
* immediately after forking children and all children will be
|
||||
* reparented to init.
|
||||
*/
|
||||
list_for_each_entry(item, &root_item->children, list) {
|
||||
list_for_each_entry(item, &root_item->children, sibling) {
|
||||
|
||||
/*
|
||||
* If a child belongs to the root task's session or it's
|
||||
|
|
@ -229,19 +229,19 @@ int prepare_pstree_ids(void)
|
|||
helper->pid.virt = item->sid;
|
||||
helper->state = TASK_HELPER;
|
||||
helper->parent = root_item;
|
||||
list_add_tail(&helper->list, &helpers);
|
||||
list_add_tail(&helper->sibling, &helpers);
|
||||
task_entries->nr_helpers++;
|
||||
|
||||
pr_info("Add a helper %d for restoring SID %d\n",
|
||||
helper->pid.virt, helper->sid);
|
||||
|
||||
child = list_entry(item->list.prev, struct pstree_item, list);
|
||||
child = list_entry(item->sibling.prev, struct pstree_item, sibling);
|
||||
item = child;
|
||||
|
||||
/*
|
||||
* Stack on helper task all children with target sid.
|
||||
*/
|
||||
list_for_each_entry_safe_continue(child, tmp, &root_item->children, list) {
|
||||
list_for_each_entry_safe_continue(child, tmp, &root_item->children, sibling) {
|
||||
if (child->sid != helper->sid)
|
||||
continue;
|
||||
if (child->sid == child->pid.virt)
|
||||
|
|
@ -251,7 +251,7 @@ int prepare_pstree_ids(void)
|
|||
child->pid.virt, helper->pid.virt);
|
||||
|
||||
child->parent = helper;
|
||||
list_move(&child->list, &helper->children);
|
||||
list_move(&child->sibling, &helper->children);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -294,7 +294,7 @@ int prepare_pstree_ids(void)
|
|||
pr_info("Session leader %d\n", item->sid);
|
||||
|
||||
/* Try to find helpers, who should be connected to the leader */
|
||||
list_for_each_entry(child, &helpers, list) {
|
||||
list_for_each_entry(child, &helpers, sibling) {
|
||||
if (child->state != TASK_HELPER)
|
||||
continue;
|
||||
|
||||
|
|
@ -304,7 +304,7 @@ int prepare_pstree_ids(void)
|
|||
child->pgid = item->pgid;
|
||||
child->pid.virt = ++max_pid;
|
||||
child->parent = item;
|
||||
list_move(&child->list, &item->children);
|
||||
list_move(&child->sibling, &item->children);
|
||||
|
||||
pr_info("Attach %d to the task %d\n",
|
||||
child->pid.virt, item->pid.virt);
|
||||
|
|
@ -339,7 +339,7 @@ int prepare_pstree_ids(void)
|
|||
helper->pid.virt = item->pgid;
|
||||
helper->state = TASK_HELPER;
|
||||
helper->parent = item;
|
||||
list_add(&helper->list, &item->children);
|
||||
list_add(&helper->sibling, &item->children);
|
||||
task_entries->nr_helpers++;
|
||||
|
||||
pr_info("Add a helper %d for restoring PGID %d\n",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue