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
7 #ifndef _LINUX_THREAD_INFO_H
8 #define _LINUX_THREAD_INFO_H
11 * System call restart block.
13 struct restart_block
{
14 long (*fn
)(struct restart_block
*);
15 unsigned long arg0
, arg1
, arg2
, arg3
;
18 extern long do_no_restart_syscall(struct restart_block
*parm
);
20 #include <linux/bitops.h>
21 #include <asm/thread_info.h>
26 * flag set/clear/test wrappers
27 * - pass TIF_xxxx constants to these functions
30 static inline void set_thread_flag(int flag
)
32 set_bit(flag
,¤t_thread_info()->flags
);
35 static inline void clear_thread_flag(int flag
)
37 clear_bit(flag
,¤t_thread_info()->flags
);
40 static inline int test_and_set_thread_flag(int flag
)
42 return test_and_set_bit(flag
,¤t_thread_info()->flags
);
45 static inline int test_and_clear_thread_flag(int flag
)
47 return test_and_clear_bit(flag
,¤t_thread_info()->flags
);
50 static inline int test_thread_flag(int flag
)
52 return test_bit(flag
,¤t_thread_info()->flags
);
55 static inline void set_ti_thread_flag(struct thread_info
*ti
, int flag
)
57 set_bit(flag
,&ti
->flags
);
60 static inline void clear_ti_thread_flag(struct thread_info
*ti
, int flag
)
62 clear_bit(flag
,&ti
->flags
);
65 static inline int test_and_set_ti_thread_flag(struct thread_info
*ti
, int flag
)
67 return test_and_set_bit(flag
,&ti
->flags
);
70 static inline int test_and_clear_ti_thread_flag(struct thread_info
*ti
, int flag
)
72 return test_and_clear_bit(flag
,&ti
->flags
);
75 static inline int test_ti_thread_flag(struct thread_info
*ti
, int flag
)
77 return test_bit(flag
,&ti
->flags
);
80 static inline void set_need_resched(void)
82 set_thread_flag(TIF_NEED_RESCHED
);
85 static inline void clear_need_resched(void)
87 clear_thread_flag(TIF_NEED_RESCHED
);
92 #endif /* _LINUX_THREAD_INFO_H */