Blame view
include/linux/thread_info.h
3.32 KB
1da177e4c Linux-2.6.12-rc2 |
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 futex: fix for fu... |
9 |
#include <linux/types.h> |
edd63a276 set_restore_sigma... |
10 |
#include <linux/bug.h> |
ce6bd420f futex: fix for fu... |
11 |
|
a332d86d3 hrtimer: add nano... |
12 13 |
struct timespec; struct compat_timespec; |
c65eacbe2 sched/core: Allow... |
14 |
#ifdef CONFIG_THREAD_INFO_IN_TASK |
c65eacbe2 sched/core: Allow... |
15 16 |
#define current_thread_info() ((struct thread_info *)current) #endif |
1da177e4c Linux-2.6.12-rc2 |
17 |
/* |
ce6bd420f futex: fix for fu... |
18 |
* System call restart block. |
1da177e4c Linux-2.6.12-rc2 |
19 20 21 |
*/ struct restart_block { long (*fn)(struct restart_block *); |
ce6bd420f futex: fix for fu... |
22 |
union { |
52400ba94 futex: add requeu... |
23 |
/* For futex_wait and futex_wait_requeue_pi */ |
ce6bd420f futex: fix for fu... |
24 |
struct { |
a3c74c525 futex: Mark resta... |
25 |
u32 __user *uaddr; |
ce6bd420f futex: fix for fu... |
26 27 |
u32 val; u32 flags; |
cd689985c futex: Add bitset... |
28 |
u32 bitset; |
ce6bd420f futex: fix for fu... |
29 |
u64 time; |
a3c74c525 futex: Mark resta... |
30 |
u32 __user *uaddr2; |
ce6bd420f futex: fix for fu... |
31 |
} futex; |
a332d86d3 hrtimer: add nano... |
32 33 |
/* For nanosleep */ struct { |
ab8177bc5 hrtimers: Avoid t... |
34 |
clockid_t clockid; |
a332d86d3 hrtimer: add nano... |
35 36 37 38 39 40 |
struct timespec __user *rmtp; #ifdef CONFIG_COMPAT struct compat_timespec __user *compat_rmtp; #endif u64 expires; } nanosleep; |
be5dad20a select: add a pol... |
41 42 43 44 45 46 47 48 |
/* For poll */ struct { struct pollfd __user *ufds; int nfds; int has_timeout; unsigned long tv_sec; unsigned long tv_nsec; } poll; |
ce6bd420f futex: fix for fu... |
49 |
}; |
1da177e4c Linux-2.6.12-rc2 |
50 51 52 53 54 55 56 57 |
}; extern long do_no_restart_syscall(struct restart_block *parm); #include <linux/bitops.h> #include <asm/thread_info.h> #ifdef __KERNEL__ |
2889f6081 fork: Move thread... |
58 |
#ifdef CONFIG_DEBUG_STACK_USAGE |
5d097056c kmemcg: account c... |
59 60 |
# define THREADINFO_GFP (GFP_KERNEL_ACCOUNT | __GFP_NOTRACK | \ __GFP_ZERO) |
2889f6081 fork: Move thread... |
61 |
#else |
5d097056c kmemcg: account c... |
62 |
# define THREADINFO_GFP (GFP_KERNEL_ACCOUNT | __GFP_NOTRACK) |
2889f6081 fork: Move thread... |
63 |
#endif |
1da177e4c Linux-2.6.12-rc2 |
64 65 66 67 |
/* * flag set/clear/test wrappers * - pass TIF_xxxx constants to these functions */ |
1da177e4c Linux-2.6.12-rc2 |
68 69 |
static inline void set_ti_thread_flag(struct thread_info *ti, int flag) { |
5548fecdf x86: clean up bit... |
70 |
set_bit(flag, (unsigned long *)&ti->flags); |
1da177e4c Linux-2.6.12-rc2 |
71 72 73 74 |
} static inline void clear_ti_thread_flag(struct thread_info *ti, int flag) { |
5548fecdf x86: clean up bit... |
75 |
clear_bit(flag, (unsigned long *)&ti->flags); |
1da177e4c Linux-2.6.12-rc2 |
76 77 78 79 |
} static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag) { |
5548fecdf x86: clean up bit... |
80 |
return test_and_set_bit(flag, (unsigned long *)&ti->flags); |
1da177e4c Linux-2.6.12-rc2 |
81 82 83 84 |
} static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag) { |
5548fecdf x86: clean up bit... |
85 |
return test_and_clear_bit(flag, (unsigned long *)&ti->flags); |
1da177e4c Linux-2.6.12-rc2 |
86 87 88 89 |
} static inline int test_ti_thread_flag(struct thread_info *ti, int flag) { |
5548fecdf x86: clean up bit... |
90 |
return test_bit(flag, (unsigned long *)&ti->flags); |
1da177e4c Linux-2.6.12-rc2 |
91 |
} |
3b66a1edb [PATCH] m68k: con... |
92 93 94 95 96 97 98 99 100 101 |
#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) |
ea8117478 sched, idle: Fix ... |
102 |
#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) |
0f60a8efe mm: Implement sta... |
103 104 105 106 107 108 109 110 |
#ifndef CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES static inline int arch_within_stack_frames(const void * const stack, const void * const stackend, const void *obj, unsigned long len) { return 0; } #endif |
f5509cc18 mm: Hardened user... |
111 112 113 |
#ifdef CONFIG_HARDENED_USERCOPY extern void __check_object_size(const void *ptr, unsigned long n, bool to_user); |
a85d6b824 usercopy: force c... |
114 115 |
static __always_inline void check_object_size(const void *ptr, unsigned long n, bool to_user) |
f5509cc18 mm: Hardened user... |
116 |
{ |
81409e9e2 usercopy: fold bu... |
117 118 |
if (!__builtin_constant_p(n)) __check_object_size(ptr, n, to_user); |
f5509cc18 mm: Hardened user... |
119 120 121 122 123 124 |
} #else static inline void check_object_size(const void *ptr, unsigned long n, bool to_user) { } #endif /* CONFIG_HARDENED_USERCOPY */ |
4e4c22c71 signals: add set_... |
125 |
#endif /* __KERNEL__ */ |
1da177e4c Linux-2.6.12-rc2 |
126 127 |
#endif /* _LINUX_THREAD_INFO_H */ |