1 #ifndef _LINUX_SCHED_USER_H 2 #define _LINUX_SCHED_USER_H 3 4 #include <linux/sched.h> 5 6 struct key; 7 8 /* 9 * Some day this will be a full-fledged user tracking system.. 10 */ 11 struct user_struct { 12 atomic_t __count; /* reference count */ 13 atomic_t processes; /* How many processes does this user have? */ 14 atomic_t sigpending; /* How many pending signals does this user have? */ 15 #ifdef CONFIG_FANOTIFY 16 atomic_t fanotify_listeners; 17 #endif 18 #ifdef CONFIG_EPOLL 19 atomic_long_t epoll_watches; /* The number of file descriptors currently watched */ 20 #endif 21 #ifdef CONFIG_POSIX_MQUEUE 22 /* protected by mq_lock */ 23 unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */ 24 #endif 25 unsigned long locked_shm; /* How many pages of mlocked shm ? */ 26 unsigned long unix_inflight; /* How many files in flight in unix sockets */ 27 atomic_long_t pipe_bufs; /* how many pages are allocated in pipe buffers */ 28 29 #ifdef CONFIG_KEYS 30 struct key *uid_keyring; /* UID specific keyring */ 31 struct key *session_keyring; /* UID's default session keyring */ 32 #endif 33 34 /* Hash table maintenance information */ 35 struct hlist_node uidhash_node; 36 kuid_t uid; 37 38 #if defined(CONFIG_PERF_EVENTS) || defined(CONFIG_BPF_SYSCALL) 39 atomic_long_t locked_vm; 40 #endif 41 }; 42 43 extern int uids_sysfs_init(void); 44 45 extern struct user_struct *find_user(kuid_t); 46 47 extern struct user_struct root_user; 48 #define INIT_USER (&root_user) 49 50 51 /* per-UID process charging. */ 52 extern struct user_struct * alloc_uid(kuid_t); 53 static inline struct user_struct *get_uid(struct user_struct *u) 54 { 55 atomic_inc(&u->__count); 56 return u; 57 } 58 extern void free_uid(struct user_struct *); 59 60 #endif /* _LINUX_SCHED_USER_H */ 61