Blame view
include/linux/thread_info.h
3.43 KB
1da177e4c
|
1 2 3 4 5 6 7 8 |
/* thread_info.h: common low-level thread information accessors * * Copyright (C) 2002 David Howells (dhowells@redhat.com) * - Incorporating suggestions made by Linus Torvalds */ #ifndef _LINUX_THREAD_INFO_H #define _LINUX_THREAD_INFO_H |
ce6bd420f
|
9 |
#include <linux/types.h> |
a332d86d3
|
10 11 |
struct timespec; struct compat_timespec; |
1da177e4c
|
12 |
/* |
ce6bd420f
|
13 |
* System call restart block. |
1da177e4c
|
14 15 16 |
*/ struct restart_block { long (*fn)(struct restart_block *); |
ce6bd420f
|
17 18 19 20 |
union { struct { unsigned long arg0, arg1, arg2, arg3; }; |
52400ba94
|
21 |
/* For futex_wait and futex_wait_requeue_pi */ |
ce6bd420f
|
22 23 24 25 |
struct { u32 *uaddr; u32 val; u32 flags; |
cd689985c
|
26 |
u32 bitset; |
ce6bd420f
|
27 |
u64 time; |
52400ba94
|
28 |
u32 *uaddr2; |
ce6bd420f
|
29 |
} futex; |
a332d86d3
|
30 31 32 33 34 35 36 37 38 |
/* For nanosleep */ struct { clockid_t index; struct timespec __user *rmtp; #ifdef CONFIG_COMPAT struct compat_timespec __user *compat_rmtp; #endif u64 expires; } nanosleep; |
be5dad20a
|
39 40 41 42 43 44 45 46 |
/* For poll */ struct { struct pollfd __user *ufds; int nfds; int has_timeout; unsigned long tv_sec; unsigned long tv_nsec; } poll; |
ce6bd420f
|
47 |
}; |
1da177e4c
|
48 49 50 51 52 53 54 55 56 57 58 59 60 |
}; extern long do_no_restart_syscall(struct restart_block *parm); #include <linux/bitops.h> #include <asm/thread_info.h> #ifdef __KERNEL__ /* * flag set/clear/test wrappers * - pass TIF_xxxx constants to these functions */ |
1da177e4c
|
61 62 |
static inline void set_ti_thread_flag(struct thread_info *ti, int flag) { |
5548fecdf
|
63 |
set_bit(flag, (unsigned long *)&ti->flags); |
1da177e4c
|
64 65 66 67 |
} static inline void clear_ti_thread_flag(struct thread_info *ti, int flag) { |
5548fecdf
|
68 |
clear_bit(flag, (unsigned long *)&ti->flags); |
1da177e4c
|
69 70 71 72 |
} static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag) { |
5548fecdf
|
73 |
return test_and_set_bit(flag, (unsigned long *)&ti->flags); |
1da177e4c
|
74 75 76 77 |
} static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag) { |
5548fecdf
|
78 |
return test_and_clear_bit(flag, (unsigned long *)&ti->flags); |
1da177e4c
|
79 80 81 82 |
} static inline int test_ti_thread_flag(struct thread_info *ti, int flag) { |
5548fecdf
|
83 |
return test_bit(flag, (unsigned long *)&ti->flags); |
1da177e4c
|
84 |
} |
3b66a1edb
|
85 86 87 88 89 90 91 92 93 94 95 96 97 |
#define set_thread_flag(flag) \ set_ti_thread_flag(current_thread_info(), flag) #define clear_thread_flag(flag) \ clear_ti_thread_flag(current_thread_info(), flag) #define test_and_set_thread_flag(flag) \ test_and_set_ti_thread_flag(current_thread_info(), flag) #define test_and_clear_thread_flag(flag) \ test_and_clear_ti_thread_flag(current_thread_info(), flag) #define test_thread_flag(flag) \ test_ti_thread_flag(current_thread_info(), flag) #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) |
1da177e4c
|
98 |
|
f3de272b8
|
99 100 101 102 103 104 |
#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK /* * An arch can define its own version of set_restore_sigmask() to get the * job done however works, with or without TIF_RESTORE_SIGMASK. */ #define HAVE_SET_RESTORE_SIGMASK 1 |
4e4c22c71
|
105 106 107 108 |
/** * set_restore_sigmask() - make sure saved_sigmask processing gets done * * This sets TIF_RESTORE_SIGMASK and ensures that the arch signal code |
7648d961f
|
109 110 111 112 113 114 |
* will run before returning to user mode, to process the flag. For * all callers, TIF_SIGPENDING is already set or it's no harm to set * it. TIF_RESTORE_SIGMASK need not be in the set of bits that the * arch code will notice on return to user mode, in case those bits * are scarce. We set TIF_SIGPENDING here to ensure that the arch * signal code always gets run when TIF_RESTORE_SIGMASK is set. |
4e4c22c71
|
115 116 117 118 |
*/ static inline void set_restore_sigmask(void) { set_thread_flag(TIF_RESTORE_SIGMASK); |
7648d961f
|
119 |
set_thread_flag(TIF_SIGPENDING); |
4e4c22c71
|
120 |
} |
f3de272b8
|
121 |
#endif /* TIF_RESTORE_SIGMASK && !HAVE_SET_RESTORE_SIGMASK */ |
4e4c22c71
|
122 123 |
#endif /* __KERNEL__ */ |
1da177e4c
|
124 125 |
#endif /* _LINUX_THREAD_INFO_H */ |