]> err.no Git - linux-2.6/blobdiff - include/linux/sched.h
[PATCH] libata-hp-prep: add prereset() method and implement ata_std_prereset()
[linux-2.6] / include / linux / sched.h
index e194ec75833d6420ed9b3808f285d66355e93871..29b7d4f87d207a69a1b8a2c0167416f1332f030d 100644 (file)
@@ -911,7 +911,6 @@ static inline int pid_alive(struct task_struct *p)
 extern void free_task(struct task_struct *tsk);
 #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
 
-extern void __put_task_struct_cb(struct rcu_head *rhp);
 extern void __put_task_struct(struct task_struct *t);
 
 static inline void put_task_struct(struct task_struct *t)
@@ -1193,8 +1192,7 @@ extern void wait_task_inactive(task_t * p);
 #define remove_parent(p)       list_del_init(&(p)->sibling)
 #define add_parent(p)          list_add_tail(&(p)->sibling,&(p)->parent->children)
 
-#define next_task(p)   list_entry((p)->tasks.next, struct task_struct, tasks)
-#define prev_task(p)   list_entry((p)->tasks.prev, struct task_struct, tasks)
+#define next_task(p)   list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks)
 
 #define for_each_process(p) \
        for (p = &init_task ; (p = next_task(p)) != &init_task ; )
@@ -1209,9 +1207,10 @@ extern void wait_task_inactive(task_t * p);
 #define while_each_thread(g, t) \
        while ((t = next_thread(t)) != g)
 
-#define thread_group_leader(p) (p->pid == p->tgid)
+/* de_thread depends on thread_group_leader not being a pid based check */
+#define thread_group_leader(p) (p == p->group_leader)
 
-static inline task_t *next_thread(task_t *p)
+static inline task_t *next_thread(const task_t *p)
 {
        return list_entry(rcu_dereference(p->thread_group.next),
                                task_t, thread_group);