The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/kernel/user-return-notifier.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 
    2 #include <linux/user-return-notifier.h>
    3 #include <linux/percpu.h>
    4 #include <linux/sched.h>
    5 #include <linux/export.h>
    6 
    7 static DEFINE_PER_CPU(struct hlist_head, return_notifier_list);
    8 
    9 /*
   10  * Request a notification when the current cpu returns to userspace.  Must be
   11  * called in atomic context.  The notifier will also be called in atomic
   12  * context.
   13  */
   14 void user_return_notifier_register(struct user_return_notifier *urn)
   15 {
   16         set_tsk_thread_flag(current, TIF_USER_RETURN_NOTIFY);
   17         hlist_add_head(&urn->link, &__get_cpu_var(return_notifier_list));
   18 }
   19 EXPORT_SYMBOL_GPL(user_return_notifier_register);
   20 
   21 /*
   22  * Removes a registered user return notifier.  Must be called from atomic
   23  * context, and from the same cpu registration occurred in.
   24  */
   25 void user_return_notifier_unregister(struct user_return_notifier *urn)
   26 {
   27         hlist_del(&urn->link);
   28         if (hlist_empty(&__get_cpu_var(return_notifier_list)))
   29                 clear_tsk_thread_flag(current, TIF_USER_RETURN_NOTIFY);
   30 }
   31 EXPORT_SYMBOL_GPL(user_return_notifier_unregister);
   32 
   33 /* Calls registered user return notifiers */
   34 void fire_user_return_notifiers(void)
   35 {
   36         struct user_return_notifier *urn;
   37         struct hlist_node *tmp1, *tmp2;
   38         struct hlist_head *head;
   39 
   40         head = &get_cpu_var(return_notifier_list);
   41         hlist_for_each_entry_safe(urn, tmp1, tmp2, head, link)
   42                 urn->on_user_return(urn);
   43         put_cpu_var(return_notifier_list);
   44 }

Cache object: f0e6df526dc3baa58d9d4ae6f668d0cc


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.