Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* thread_info.h: common low-level thread information accessors |
2 | * | |
3 | * Copyright (C) 2002 David Howells (dhowells@redhat.com) | |
4 | * - Incorporating suggestions made by Linus Torvalds | |
5 | */ | |
6 | ||
7 | #ifndef _LINUX_THREAD_INFO_H | |
8 | #define _LINUX_THREAD_INFO_H | |
9 | ||
ce6bd420 SR |
10 | #include <linux/types.h> |
11 | ||
1da177e4 | 12 | /* |
ce6bd420 | 13 | * System call restart block. |
1da177e4 LT |
14 | */ |
15 | struct restart_block { | |
16 | long (*fn)(struct restart_block *); | |
ce6bd420 SR |
17 | union { |
18 | struct { | |
19 | unsigned long arg0, arg1, arg2, arg3; | |
20 | }; | |
21 | /* For futex_wait */ | |
22 | struct { | |
23 | u32 *uaddr; | |
24 | u32 val; | |
25 | u32 flags; | |
26 | u64 time; | |
27 | } futex; | |
28 | }; | |
1da177e4 LT |
29 | }; |
30 | ||
31 | extern long do_no_restart_syscall(struct restart_block *parm); | |
32 | ||
33 | #include <linux/bitops.h> | |
34 | #include <asm/thread_info.h> | |
35 | ||
36 | #ifdef __KERNEL__ | |
37 | ||
38 | /* | |
39 | * flag set/clear/test wrappers | |
40 | * - pass TIF_xxxx constants to these functions | |
41 | */ | |
42 | ||
1da177e4 LT |
43 | static inline void set_ti_thread_flag(struct thread_info *ti, int flag) |
44 | { | |
45 | set_bit(flag,&ti->flags); | |
46 | } | |
47 | ||
48 | static inline void clear_ti_thread_flag(struct thread_info *ti, int flag) | |
49 | { | |
50 | clear_bit(flag,&ti->flags); | |
51 | } | |
52 | ||
53 | static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag) | |
54 | { | |
55 | return test_and_set_bit(flag,&ti->flags); | |
56 | } | |
57 | ||
58 | static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag) | |
59 | { | |
60 | return test_and_clear_bit(flag,&ti->flags); | |
61 | } | |
62 | ||
63 | static inline int test_ti_thread_flag(struct thread_info *ti, int flag) | |
64 | { | |
65 | return test_bit(flag,&ti->flags); | |
66 | } | |
67 | ||
3b66a1ed RZ |
68 | #define set_thread_flag(flag) \ |
69 | set_ti_thread_flag(current_thread_info(), flag) | |
70 | #define clear_thread_flag(flag) \ | |
71 | clear_ti_thread_flag(current_thread_info(), flag) | |
72 | #define test_and_set_thread_flag(flag) \ | |
73 | test_and_set_ti_thread_flag(current_thread_info(), flag) | |
74 | #define test_and_clear_thread_flag(flag) \ | |
75 | test_and_clear_ti_thread_flag(current_thread_info(), flag) | |
76 | #define test_thread_flag(flag) \ | |
77 | test_ti_thread_flag(current_thread_info(), flag) | |
78 | ||
79 | #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) | |
80 | #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) | |
1da177e4 LT |
81 | |
82 | #endif | |
83 | ||
84 | #endif /* _LINUX_THREAD_INFO_H */ |