summaryrefslogtreecommitdiff
path: root/kernel/user.c
diff options
context:
space:
mode:
authorConnor O'Brien <connoro@google.com>2017-10-16 10:30:24 -0700
committerConnor O'Brien <connoro@google.com>2018-03-06 20:39:55 +0000
commit552095deb5650aa958cb29c6ae712728d38c4a5a (patch)
treede4eda73379603c0441fb3f4a1cca093d9b91cea /kernel/user.c
parent229c03238f0cf3679d2fdf16fa9f207420d99d41 (diff)
ANDROID: proc: Add /proc/uid directory
Add support for reporting per-uid information through procfs, roughly following the approach used for per-tid and per-tgid directories in fs/proc/base.c. This also entails some new tracking of which uids have been used, to avoid losing information when the last task with a given uid exits. Signed-off-by: Connor O'Brien <connoro@google.com> Bug: 72339335 Test: ls /proc/uid/; compare with UIDs in /proc/uid_time_in_state Change-Id: I0908f0c04438b11ceb673d860e58441bf503d478
Diffstat (limited to 'kernel/user.c')
-rw-r--r--kernel/user.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/user.c b/kernel/user.c
index b069ccbfb0b0..41e94e453836 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -16,6 +16,7 @@
#include <linux/interrupt.h>
#include <linux/export.h>
#include <linux/user_namespace.h>
+#include <linux/proc_fs.h>
#include <linux/proc_ns.h>
/*
@@ -201,6 +202,7 @@ struct user_struct *alloc_uid(kuid_t uid)
}
spin_unlock_irq(&uidhash_lock);
}
+ proc_register_uid(uid);
return up;
@@ -222,6 +224,7 @@ static int __init uid_cache_init(void)
spin_lock_irq(&uidhash_lock);
uid_hash_insert(&root_user, uidhashentry(GLOBAL_ROOT_UID));
spin_unlock_irq(&uidhash_lock);
+ proc_register_uid(GLOBAL_ROOT_UID);
return 0;
}