aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-10-19 02:39:57 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 14:53:38 -0400
commit03ff17979c58a0b63b0fe30a373f41b719731bd2 (patch)
treec6369ebab7a3035b309de5f288d6e8fc149b3d69
parentd473012710b815741043942bc41945d444abab40 (diff)
kernel/exit.c: Use list_for_each_entry(_safe) instead of list_for_each(_safe)
kernel/exit.c: Convert list_for_each(_safe) to list_for_each_entry(_safe) in forget_original_parent(), exit_notify() and do_wait() Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/exit.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index db9764186d5a..c5d97af12159 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -669,8 +669,7 @@ reparent_thread(struct task_struct *p, struct task_struct *father, int traced)
669static void 669static void
670forget_original_parent(struct task_struct *father, struct list_head *to_release) 670forget_original_parent(struct task_struct *father, struct list_head *to_release)
671{ 671{
672 struct task_struct *p, *reaper = father; 672 struct task_struct *p, *n, *reaper = father;
673 struct list_head *_p, *_n;
674 673
675 do { 674 do {
676 reaper = next_thread(reaper); 675 reaper = next_thread(reaper);
@@ -688,9 +687,8 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release)
688 * 687 *
689 * Search them and reparent children. 688 * Search them and reparent children.
690 */ 689 */
691 list_for_each_safe(_p, _n, &father->children) { 690 list_for_each_entry_safe(p, n, &father->children, sibling) {
692 int ptrace; 691 int ptrace;
693 p = list_entry(_p, struct task_struct, sibling);
694 692
695 ptrace = p->ptrace; 693 ptrace = p->ptrace;
696 694
@@ -718,8 +716,7 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release)
718 if (unlikely(ptrace && p->exit_state == EXIT_ZOMBIE && p->exit_signal == -1)) 716 if (unlikely(ptrace && p->exit_state == EXIT_ZOMBIE && p->exit_signal == -1))
719 list_add(&p->ptrace_list, to_release); 717 list_add(&p->ptrace_list, to_release);
720 } 718 }
721 list_for_each_safe(_p, _n, &father->ptrace_children) { 719 list_for_each_entry_safe(p, n, &father->ptrace_children, ptrace_list) {
722 p = list_entry(_p, struct task_struct, ptrace_list);
723 p->real_parent = reaper; 720 p->real_parent = reaper;
724 reparent_thread(p, father, 1); 721 reparent_thread(p, father, 1);
725 } 722 }
@@ -1518,12 +1515,9 @@ repeat:
1518 tsk = current; 1515 tsk = current;
1519 do { 1516 do {
1520 struct task_struct *p; 1517 struct task_struct *p;
1521 struct list_head *_p;
1522 int ret; 1518 int ret;
1523 1519
1524 list_for_each(_p,&tsk->children) { 1520 list_for_each_entry(p, &tsk->children, sibling) {
1525 p = list_entry(_p, struct task_struct, sibling);
1526
1527 ret = eligible_child(pid, options, p); 1521 ret = eligible_child(pid, options, p);
1528 if (!ret) 1522 if (!ret)
1529 continue; 1523 continue;
@@ -1605,9 +1599,8 @@ check_continued:
1605 } 1599 }
1606 } 1600 }
1607 if (!flag) { 1601 if (!flag) {
1608 list_for_each(_p, &tsk->ptrace_children) { 1602 list_for_each_entry(p, &tsk->ptrace_children,
1609 p = list_entry(_p, struct task_struct, 1603 ptrace_list) {
1610 ptrace_list);
1611 if (!eligible_child(pid, options, p)) 1604 if (!eligible_child(pid, options, p))
1612 continue; 1605 continue;
1613 flag = 1; 1606 flag = 1;