aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-03-24 21:36:23 -0400
committerRoland McGrath <roland@redhat.com>2008-07-16 21:02:33 -0400
commitf470021adb9190819c03d6d8c5c860a17480aa6d (patch)
tree9e5c2808138624e272b562a502cfd035ae59c268 /include/linux
parent98abed02007b19bbfd68b6d06a5485afc3eeb01b (diff)
ptrace children revamp
ptrace no longer fiddles with the children/sibling links, and the old ptrace_children list is gone. Now ptrace, whether of one's own children or another's via PTRACE_ATTACH, just uses the new ptraced list instead. There should be no user-visible difference that matters. The only change is the order in which do_wait() sees multiple stopped children and stopped ptrace attachees. Since wait_task_stopped() was changed earlier so it no longer reorders the children list, we already know this won't cause any new problems. Signed-off-by: Roland McGrath <roland@redhat.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/init_task.h4
-rw-r--r--include/linux/sched.h26
2 files changed, 14 insertions, 16 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 9927a88674a3..93c45acf249a 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -140,8 +140,8 @@ extern struct group_info init_groups;
140 .nr_cpus_allowed = NR_CPUS, \ 140 .nr_cpus_allowed = NR_CPUS, \
141 }, \ 141 }, \
142 .tasks = LIST_HEAD_INIT(tsk.tasks), \ 142 .tasks = LIST_HEAD_INIT(tsk.tasks), \
143 .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children), \ 143 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
144 .ptrace_list = LIST_HEAD_INIT(tsk.ptrace_list), \ 144 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
145 .real_parent = &tsk, \ 145 .real_parent = &tsk, \
146 .parent = &tsk, \ 146 .parent = &tsk, \
147 .children = LIST_HEAD_INIT(tsk.children), \ 147 .children = LIST_HEAD_INIT(tsk.children), \
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ba2f859c6e4f..1941d8b5cf11 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1062,12 +1062,6 @@ struct task_struct {
1062#endif 1062#endif
1063 1063
1064 struct list_head tasks; 1064 struct list_head tasks;
1065 /*
1066 * ptrace_list/ptrace_children forms the list of my children
1067 * that were stolen by a ptracer.
1068 */
1069 struct list_head ptrace_children;
1070 struct list_head ptrace_list;
1071 1065
1072 struct mm_struct *mm, *active_mm; 1066 struct mm_struct *mm, *active_mm;
1073 1067
@@ -1089,18 +1083,25 @@ struct task_struct {
1089 /* 1083 /*
1090 * pointers to (original) parent process, youngest child, younger sibling, 1084 * pointers to (original) parent process, youngest child, younger sibling,
1091 * older sibling, respectively. (p->father can be replaced with 1085 * older sibling, respectively. (p->father can be replaced with
1092 * p->parent->pid) 1086 * p->real_parent->pid)
1093 */ 1087 */
1094 struct task_struct *real_parent; /* real parent process (when being debugged) */ 1088 struct task_struct *real_parent; /* real parent process */
1095 struct task_struct *parent; /* parent process */ 1089 struct task_struct *parent; /* recipient of SIGCHLD, wait4() reports */
1096 /* 1090 /*
1097 * children/sibling forms the list of my children plus the 1091 * children/sibling forms the list of my natural children
1098 * tasks I'm ptracing.
1099 */ 1092 */
1100 struct list_head children; /* list of my children */ 1093 struct list_head children; /* list of my children */
1101 struct list_head sibling; /* linkage in my parent's children list */ 1094 struct list_head sibling; /* linkage in my parent's children list */
1102 struct task_struct *group_leader; /* threadgroup leader */ 1095 struct task_struct *group_leader; /* threadgroup leader */
1103 1096
1097 /*
1098 * ptraced is the list of tasks this task is using ptrace on.
1099 * This includes both natural children and PTRACE_ATTACH targets.
1100 * p->ptrace_entry is p's link on the p->parent->ptraced list.
1101 */
1102 struct list_head ptraced;
1103 struct list_head ptrace_entry;
1104
1104 /* PID/PID hash table linkage. */ 1105 /* PID/PID hash table linkage. */
1105 struct pid_link pids[PIDTYPE_MAX]; 1106 struct pid_link pids[PIDTYPE_MAX];
1106 struct list_head thread_group; 1107 struct list_head thread_group;
@@ -1876,9 +1877,6 @@ extern void wait_task_inactive(struct task_struct * p);
1876#define wait_task_inactive(p) do { } while (0) 1877#define wait_task_inactive(p) do { } while (0)
1877#endif 1878#endif
1878 1879
1879#define remove_parent(p) list_del_init(&(p)->sibling)
1880#define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children)
1881
1882#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks) 1880#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks)
1883 1881
1884#define for_each_process(p) \ 1882#define for_each_process(p) \