patch-2.4.23 linux-2.4.23/kernel/user.c
Next file: linux-2.4.23/lib/Config.in
Previous file: linux-2.4.23/kernel/sysctl.c
Back to the patch index
Back to the overall index
- Lines: 24
- Date:
2003-11-28 10:26:21.000000000 -0800
- Orig file:
linux-2.4.22/kernel/user.c
- Orig date:
2000-11-28 22:43:39.000000000 -0800
diff -urN linux-2.4.22/kernel/user.c linux-2.4.23/kernel/user.c
@@ -120,6 +120,23 @@
return up;
}
+void switch_uid(struct user_struct *new_user)
+{
+ struct user_struct *old_user;
+
+ /* What if a process setreuid()'s and this brings the
+ * new uid over his NPROC rlimit? We can check this now
+ * cheaply with the new uid cache, so if it matters
+ * we should be checking for it. -DaveM
+ */
+ old_user = current->user;
+ atomic_inc(&new_user->__count);
+ atomic_inc(&new_user->processes);
+ atomic_dec(&old_user->processes);
+ current->user = new_user;
+ free_uid(old_user);
+}
+
static int __init uid_cache_init(void)
{
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)