patch-2.4.0-test6 linux/include/linux/sched.h
Next file: linux/include/linux/slab.h
Previous file: linux/include/linux/raid/raid5.h
Back to the patch index
Back to the overall index
- Lines: 47
- Date:
Wed Aug 9 18:57:55 2000
- Orig file:
v2.4.0-test5/linux/include/linux/sched.h
- Orig date:
Thu Jul 27 17:38:02 2000
diff -u --recursive --new-file v2.4.0-test5/linux/include/linux/sched.h linux/include/linux/sched.h
@@ -243,10 +243,24 @@
/*
* Some day this will be a full-fledged user tracking system..
- * Right now it is only used to track how many processes a
- * user has, but it has the potential to track memory usage etc.
*/
-struct user_struct;
+struct user_struct {
+ atomic_t __count; /* reference count */
+ atomic_t processes; /* How many processes does this user have? */
+ atomic_t files; /* How many open files does this user have? */
+
+ /* Hash table maintenance information */
+ struct user_struct *next, **pprev;
+ unsigned int uid;
+};
+
+#define get_current_user() ({ \
+ struct user_struct *__user = current->user; \
+ atomic_inc(&__user->__count); \
+ __user; })
+
+extern struct user_struct root_user;
+#define INIT_USER (&root_user)
struct task_struct {
/*
@@ -427,6 +441,7 @@
cap_permitted: CAP_FULL_SET, \
keep_capabilities: 0, \
rlim: INIT_RLIMITS, \
+ user: INIT_USER, \
comm: "swapper", \
thread: INIT_THREAD, \
fs: &init_fs, \
@@ -489,8 +504,8 @@
}
/* per-UID process charging. */
-extern int alloc_uid(struct task_struct *);
-void free_uid(struct task_struct *);
+extern struct user_struct * alloc_uid(uid_t);
+extern void free_uid(struct user_struct *);
#include <asm/current.h>
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)