aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-31 19:45:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-31 19:45:47 -0500
commit75659ca0c10992dcb39258518368a0f6f56e935d (patch)
tree5d014ceb2f10158061a23d0d976f9a613d85e659 /include/linux/sched.h
parentfbdde7bd274d74729954190f99afcb1e3d9bbfba (diff)
parent2dfe485a2c8afa54cb069fcf48476f6c90ea3fdf (diff)
Merge branch 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc
* 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc: (22 commits) Remove commented-out code copied from NFS NFS: Switch from intr mount option to TASK_KILLABLE Add wait_for_completion_killable Add wait_event_killable Add schedule_timeout_killable Use mutex_lock_killable in vfs_readdir Add mutex_lock_killable Use lock_page_killable Add lock_page_killable Add fatal_signal_pending Add TASK_WAKEKILL exit: Use task_is_* signal: Use task_is_* sched: Use task_contributes_to_load, TASK_ALL and TASK_NORMAL ptrace: Use task_is_* power: Use task_is_* wait: Use TASK_NORMAL proc/base.c: Use task_is_* proc/array.c: Use TASK_REPORT perfmon: Use task_is_* ... Fixed up conflicts in NFS/sunrpc manually..
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h36
1 files changed, 33 insertions, 3 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9d4797609aa5..6c333579d9da 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -172,13 +172,35 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
172#define TASK_RUNNING 0 172#define TASK_RUNNING 0
173#define TASK_INTERRUPTIBLE 1 173#define TASK_INTERRUPTIBLE 1
174#define TASK_UNINTERRUPTIBLE 2 174#define TASK_UNINTERRUPTIBLE 2
175#define TASK_STOPPED 4 175#define __TASK_STOPPED 4
176#define TASK_TRACED 8 176#define __TASK_TRACED 8
177/* in tsk->exit_state */ 177/* in tsk->exit_state */
178#define EXIT_ZOMBIE 16 178#define EXIT_ZOMBIE 16
179#define EXIT_DEAD 32 179#define EXIT_DEAD 32
180/* in tsk->state again */ 180/* in tsk->state again */
181#define TASK_DEAD 64 181#define TASK_DEAD 64
182#define TASK_WAKEKILL 128
183
184/* Convenience macros for the sake of set_task_state */
185#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
186#define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED)
187#define TASK_TRACED (TASK_WAKEKILL | __TASK_TRACED)
188
189/* Convenience macros for the sake of wake_up */
190#define TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE)
191#define TASK_ALL (TASK_NORMAL | __TASK_STOPPED | __TASK_TRACED)
192
193/* get_task_state() */
194#define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \
195 TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \
196 __TASK_TRACED)
197
198#define task_is_traced(task) ((task->state & __TASK_TRACED) != 0)
199#define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0)
200#define task_is_stopped_or_traced(task) \
201 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
202#define task_contributes_to_load(task) \
203 ((task->state & TASK_UNINTERRUPTIBLE) != 0)
182 204
183#define __set_task_state(tsk, state_value) \ 205#define __set_task_state(tsk, state_value) \
184 do { (tsk)->state = (state_value); } while (0) 206 do { (tsk)->state = (state_value); } while (0)
@@ -302,6 +324,7 @@ extern int in_sched_functions(unsigned long addr);
302#define MAX_SCHEDULE_TIMEOUT LONG_MAX 324#define MAX_SCHEDULE_TIMEOUT LONG_MAX
303extern signed long FASTCALL(schedule_timeout(signed long timeout)); 325extern signed long FASTCALL(schedule_timeout(signed long timeout));
304extern signed long schedule_timeout_interruptible(signed long timeout); 326extern signed long schedule_timeout_interruptible(signed long timeout);
327extern signed long schedule_timeout_killable(signed long timeout);
305extern signed long schedule_timeout_uninterruptible(signed long timeout); 328extern signed long schedule_timeout_uninterruptible(signed long timeout);
306asmlinkage void schedule(void); 329asmlinkage void schedule(void);
307 330
@@ -1892,7 +1915,14 @@ static inline int signal_pending(struct task_struct *p)
1892{ 1915{
1893 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); 1916 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
1894} 1917}
1895 1918
1919extern int FASTCALL(__fatal_signal_pending(struct task_struct *p));
1920
1921static inline int fatal_signal_pending(struct task_struct *p)
1922{
1923 return signal_pending(p) && __fatal_signal_pending(p);
1924}
1925
1896static inline int need_resched(void) 1926static inline int need_resched(void)
1897{ 1927{
1898 return unlikely(test_thread_flag(TIF_NEED_RESCHED)); 1928 return unlikely(test_thread_flag(TIF_NEED_RESCHED));