Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / include / linux / thread_info.h
blob421323e5a2d6ce3e6d82b09cacf308e59c66bac7
1 /* thread_info.h: common low-level thread information accessors
3 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
4 * - Incorporating suggestions made by Linus Torvalds
5 */
7 #ifndef _LINUX_THREAD_INFO_H
8 #define _LINUX_THREAD_INFO_H
10 #include <linux/types.h>
13 * System call restart block.
15 struct restart_block {
16 long (*fn)(struct restart_block *);
17 union {
18 struct {
19 unsigned long arg0, arg1, arg2, arg3;
21 /* For futex_wait */
22 struct {
23 u32 *uaddr;
24 u32 val;
25 u32 flags;
26 u32 bitset;
27 u64 time;
28 } futex;
32 extern long do_no_restart_syscall(struct restart_block *parm);
34 #include <linux/bitops.h>
35 #include <asm/thread_info.h>
37 #ifdef __KERNEL__
40 * flag set/clear/test wrappers
41 * - pass TIF_xxxx constants to these functions
44 static inline void set_ti_thread_flag(struct thread_info *ti, int flag)
46 set_bit(flag, (unsigned long *)&ti->flags);
49 static inline void clear_ti_thread_flag(struct thread_info *ti, int flag)
51 clear_bit(flag, (unsigned long *)&ti->flags);
54 static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag)
56 return test_and_set_bit(flag, (unsigned long *)&ti->flags);
59 static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag)
61 return test_and_clear_bit(flag, (unsigned long *)&ti->flags);
64 static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
66 return test_bit(flag, (unsigned long *)&ti->flags);
69 #define set_thread_flag(flag) \
70 set_ti_thread_flag(current_thread_info(), flag)
71 #define clear_thread_flag(flag) \
72 clear_ti_thread_flag(current_thread_info(), flag)
73 #define test_and_set_thread_flag(flag) \
74 test_and_set_ti_thread_flag(current_thread_info(), flag)
75 #define test_and_clear_thread_flag(flag) \
76 test_and_clear_ti_thread_flag(current_thread_info(), flag)
77 #define test_thread_flag(flag) \
78 test_ti_thread_flag(current_thread_info(), flag)
80 #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED)
81 #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED)
83 #endif
85 #endif /* _LINUX_THREAD_INFO_H */