diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index e0054c1b9a09..d04186d8cc68 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/topology.h> | 35 | #include <linux/topology.h> |
36 | #include <linux/seccomp.h> | 36 | #include <linux/seccomp.h> |
37 | #include <linux/rcupdate.h> | 37 | #include <linux/rcupdate.h> |
38 | #include <linux/futex.h> | ||
38 | 39 | ||
39 | #include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ | 40 | #include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ |
40 | 41 | ||
@@ -354,16 +355,8 @@ struct sighand_struct { | |||
354 | atomic_t count; | 355 | atomic_t count; |
355 | struct k_sigaction action[_NSIG]; | 356 | struct k_sigaction action[_NSIG]; |
356 | spinlock_t siglock; | 357 | spinlock_t siglock; |
357 | struct rcu_head rcu; | ||
358 | }; | 358 | }; |
359 | 359 | ||
360 | extern void sighand_free_cb(struct rcu_head *rhp); | ||
361 | |||
362 | static inline void sighand_free(struct sighand_struct *sp) | ||
363 | { | ||
364 | call_rcu(&sp->rcu, sighand_free_cb); | ||
365 | } | ||
366 | |||
367 | /* | 360 | /* |
368 | * NOTE! "signal_struct" does not have it's own | 361 | * NOTE! "signal_struct" does not have it's own |
369 | * locking, because a shared signal_struct always | 362 | * locking, because a shared signal_struct always |
@@ -402,6 +395,7 @@ struct signal_struct { | |||
402 | 395 | ||
403 | /* ITIMER_REAL timer for the process */ | 396 | /* ITIMER_REAL timer for the process */ |
404 | struct hrtimer real_timer; | 397 | struct hrtimer real_timer; |
398 | struct task_struct *tsk; | ||
405 | ktime_t it_real_incr; | 399 | ktime_t it_real_incr; |
406 | 400 | ||
407 | /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ | 401 | /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ |
@@ -758,6 +752,7 @@ struct task_struct { | |||
758 | 752 | ||
759 | /* PID/PID hash table linkage. */ | 753 | /* PID/PID hash table linkage. */ |
760 | struct pid pids[PIDTYPE_MAX]; | 754 | struct pid pids[PIDTYPE_MAX]; |
755 | struct list_head thread_group; | ||
761 | 756 | ||
762 | struct completion *vfork_done; /* for vfork() */ | 757 | struct completion *vfork_done; /* for vfork() */ |
763 | int __user *set_child_tid; /* CLONE_CHILD_SETTID */ | 758 | int __user *set_child_tid; /* CLONE_CHILD_SETTID */ |
@@ -871,6 +866,11 @@ struct task_struct { | |||
871 | int cpuset_mems_generation; | 866 | int cpuset_mems_generation; |
872 | int cpuset_mem_spread_rotor; | 867 | int cpuset_mem_spread_rotor; |
873 | #endif | 868 | #endif |
869 | struct robust_list_head __user *robust_list; | ||
870 | #ifdef CONFIG_COMPAT | ||
871 | struct compat_robust_list_head __user *compat_robust_list; | ||
872 | #endif | ||
873 | |||
874 | atomic_t fs_excl; /* holding fs exclusive resources */ | 874 | atomic_t fs_excl; /* holding fs exclusive resources */ |
875 | struct rcu_head rcu; | 875 | struct rcu_head rcu; |
876 | }; | 876 | }; |
@@ -1094,7 +1094,6 @@ extern void force_sig_specific(int, struct task_struct *); | |||
1094 | extern int send_sig(int, struct task_struct *, int); | 1094 | extern int send_sig(int, struct task_struct *, int); |
1095 | extern void zap_other_threads(struct task_struct *p); | 1095 | extern void zap_other_threads(struct task_struct *p); |
1096 | extern int kill_pg(pid_t, int, int); | 1096 | extern int kill_pg(pid_t, int, int); |
1097 | extern int kill_sl(pid_t, int, int); | ||
1098 | extern int kill_proc(pid_t, int, int); | 1097 | extern int kill_proc(pid_t, int, int); |
1099 | extern struct sigqueue *sigqueue_alloc(void); | 1098 | extern struct sigqueue *sigqueue_alloc(void); |
1100 | extern void sigqueue_free(struct sigqueue *); | 1099 | extern void sigqueue_free(struct sigqueue *); |
@@ -1151,10 +1150,8 @@ extern void flush_thread(void); | |||
1151 | extern void exit_thread(void); | 1150 | extern void exit_thread(void); |
1152 | 1151 | ||
1153 | extern void exit_files(struct task_struct *); | 1152 | extern void exit_files(struct task_struct *); |
1154 | extern void exit_signal(struct task_struct *); | 1153 | extern void __cleanup_signal(struct signal_struct *); |
1155 | extern void __exit_signal(struct task_struct *); | 1154 | extern void __cleanup_sighand(struct sighand_struct *); |
1156 | extern void exit_sighand(struct task_struct *); | ||
1157 | extern void __exit_sighand(struct task_struct *); | ||
1158 | extern void exit_itimers(struct signal_struct *); | 1155 | extern void exit_itimers(struct signal_struct *); |
1159 | 1156 | ||
1160 | extern NORET_TYPE void do_group_exit(int); | 1157 | extern NORET_TYPE void do_group_exit(int); |
@@ -1178,19 +1175,7 @@ extern void wait_task_inactive(task_t * p); | |||
1178 | #endif | 1175 | #endif |
1179 | 1176 | ||
1180 | #define remove_parent(p) list_del_init(&(p)->sibling) | 1177 | #define remove_parent(p) list_del_init(&(p)->sibling) |
1181 | #define add_parent(p, parent) list_add_tail(&(p)->sibling,&(parent)->children) | 1178 | #define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children) |
1182 | |||
1183 | #define REMOVE_LINKS(p) do { \ | ||
1184 | if (thread_group_leader(p)) \ | ||
1185 | list_del_init(&(p)->tasks); \ | ||
1186 | remove_parent(p); \ | ||
1187 | } while (0) | ||
1188 | |||
1189 | #define SET_LINKS(p) do { \ | ||
1190 | if (thread_group_leader(p)) \ | ||
1191 | list_add_tail(&(p)->tasks,&init_task.tasks); \ | ||
1192 | add_parent(p, (p)->parent); \ | ||
1193 | } while (0) | ||
1194 | 1179 | ||
1195 | #define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) | 1180 | #define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) |
1196 | #define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) | 1181 | #define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) |
@@ -1208,20 +1193,22 @@ extern void wait_task_inactive(task_t * p); | |||
1208 | #define while_each_thread(g, t) \ | 1193 | #define while_each_thread(g, t) \ |
1209 | while ((t = next_thread(t)) != g) | 1194 | while ((t = next_thread(t)) != g) |
1210 | 1195 | ||
1211 | extern task_t * FASTCALL(next_thread(const task_t *p)); | ||
1212 | |||
1213 | #define thread_group_leader(p) (p->pid == p->tgid) | 1196 | #define thread_group_leader(p) (p->pid == p->tgid) |
1214 | 1197 | ||
1198 | static inline task_t *next_thread(task_t *p) | ||
1199 | { | ||
1200 | return list_entry(rcu_dereference(p->thread_group.next), | ||
1201 | task_t, thread_group); | ||
1202 | } | ||
1203 | |||
1215 | static inline int thread_group_empty(task_t *p) | 1204 | static inline int thread_group_empty(task_t *p) |
1216 | { | 1205 | { |
1217 | return list_empty(&p->pids[PIDTYPE_TGID].pid_list); | 1206 | return list_empty(&p->thread_group); |
1218 | } | 1207 | } |
1219 | 1208 | ||
1220 | #define delay_group_leader(p) \ | 1209 | #define delay_group_leader(p) \ |
1221 | (thread_group_leader(p) && !thread_group_empty(p)) | 1210 | (thread_group_leader(p) && !thread_group_empty(p)) |
1222 | 1211 | ||
1223 | extern void unhash_process(struct task_struct *p); | ||
1224 | |||
1225 | /* | 1212 | /* |
1226 | * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring | 1213 | * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring |
1227 | * subscriptions and synchronises with wait4(). Also used in procfs. Also | 1214 | * subscriptions and synchronises with wait4(). Also used in procfs. Also |
@@ -1241,6 +1228,15 @@ static inline void task_unlock(struct task_struct *p) | |||
1241 | spin_unlock(&p->alloc_lock); | 1228 | spin_unlock(&p->alloc_lock); |
1242 | } | 1229 | } |
1243 | 1230 | ||
1231 | extern struct sighand_struct *lock_task_sighand(struct task_struct *tsk, | ||
1232 | unsigned long *flags); | ||
1233 | |||
1234 | static inline void unlock_task_sighand(struct task_struct *tsk, | ||
1235 | unsigned long *flags) | ||
1236 | { | ||
1237 | spin_unlock_irqrestore(&tsk->sighand->siglock, *flags); | ||
1238 | } | ||
1239 | |||
1244 | #ifndef __HAVE_THREAD_FUNCTIONS | 1240 | #ifndef __HAVE_THREAD_FUNCTIONS |
1245 | 1241 | ||
1246 | #define task_thread_info(task) (task)->thread_info | 1242 | #define task_thread_info(task) (task)->thread_info |