Commit 17a1548a authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

pstree: Rename @list member to @sibling

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