~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/user_events.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (c) 2022, Microsoft Corporation.
  4  *
  5  * Authors:
  6  *   Beau Belgrave <beaub@linux.microsoft.com>
  7  */
  8 
  9 #ifndef _LINUX_USER_EVENTS_H
 10 #define _LINUX_USER_EVENTS_H
 11 
 12 #include <linux/list.h>
 13 #include <linux/refcount.h>
 14 #include <linux/mm_types.h>
 15 #include <linux/workqueue.h>
 16 #include <uapi/linux/user_events.h>
 17 
 18 #ifdef CONFIG_USER_EVENTS
 19 struct user_event_mm {
 20         struct list_head        mms_link;
 21         struct list_head        enablers;
 22         struct mm_struct        *mm;
 23         /* Used for one-shot lists, protected by event_mutex */
 24         struct user_event_mm    *next;
 25         refcount_t              refcnt;
 26         refcount_t              tasks;
 27         struct rcu_work         put_rwork;
 28 };
 29 
 30 extern void user_event_mm_dup(struct task_struct *t,
 31                               struct user_event_mm *old_mm);
 32 
 33 extern void user_event_mm_remove(struct task_struct *t);
 34 
 35 static inline void user_events_fork(struct task_struct *t,
 36                                     unsigned long clone_flags)
 37 {
 38         struct user_event_mm *old_mm;
 39 
 40         if (!t || !current->user_event_mm)
 41                 return;
 42 
 43         old_mm = current->user_event_mm;
 44 
 45         if (clone_flags & CLONE_VM) {
 46                 t->user_event_mm = old_mm;
 47                 refcount_inc(&old_mm->tasks);
 48                 return;
 49         }
 50 
 51         user_event_mm_dup(t, old_mm);
 52 }
 53 
 54 static inline void user_events_execve(struct task_struct *t)
 55 {
 56         if (!t || !t->user_event_mm)
 57                 return;
 58 
 59         user_event_mm_remove(t);
 60 }
 61 
 62 static inline void user_events_exit(struct task_struct *t)
 63 {
 64         if (!t || !t->user_event_mm)
 65                 return;
 66 
 67         user_event_mm_remove(t);
 68 }
 69 #else
 70 static inline void user_events_fork(struct task_struct *t,
 71                                     unsigned long clone_flags)
 72 {
 73 }
 74 
 75 static inline void user_events_execve(struct task_struct *t)
 76 {
 77 }
 78 
 79 static inline void user_events_exit(struct task_struct *t)
 80 {
 81 }
 82 #endif /* CONFIG_USER_EVENTS */
 83 
 84 #endif /* _LINUX_USER_EVENTS_H */
 85 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php