Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_USER_RETURN_NOTIFIER_H
0003 #define _LINUX_USER_RETURN_NOTIFIER_H
0004 
0005 #ifdef CONFIG_USER_RETURN_NOTIFIER
0006 
0007 #include <linux/list.h>
0008 #include <linux/sched.h>
0009 
0010 struct user_return_notifier {
0011     void (*on_user_return)(struct user_return_notifier *urn);
0012     struct hlist_node link;
0013 };
0014 
0015 
0016 void user_return_notifier_register(struct user_return_notifier *urn);
0017 void user_return_notifier_unregister(struct user_return_notifier *urn);
0018 
0019 static inline void propagate_user_return_notify(struct task_struct *prev,
0020                         struct task_struct *next)
0021 {
0022     if (test_tsk_thread_flag(prev, TIF_USER_RETURN_NOTIFY)) {
0023         clear_tsk_thread_flag(prev, TIF_USER_RETURN_NOTIFY);
0024         set_tsk_thread_flag(next, TIF_USER_RETURN_NOTIFY);
0025     }
0026 }
0027 
0028 void fire_user_return_notifiers(void);
0029 
0030 static inline void clear_user_return_notifier(struct task_struct *p)
0031 {
0032     clear_tsk_thread_flag(p, TIF_USER_RETURN_NOTIFY);
0033 }
0034 
0035 #else
0036 
0037 struct user_return_notifier {};
0038 
0039 static inline void propagate_user_return_notify(struct task_struct *prev,
0040                         struct task_struct *next)
0041 {
0042 }
0043 
0044 static inline void fire_user_return_notifiers(void) {}
0045 
0046 static inline void clear_user_return_notifier(struct task_struct *p) {}
0047 
0048 #endif
0049 
0050 #endif