aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2006-10-02 05:17:07 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:13 -0400
commitf6c7a1f34e92b0b561024ead9fa70623683025e4 (patch)
tree6906523c635c28ccf7b1d4f726e8ac67cf22d362 /fs/proc
parent20cdc894c45d2e4ab0c69e95a56b7c5ed36ae0dd (diff)
[PATCH] proc: give the root directory a task
Helper functions in base.c like proc_pident_readdir and proc_pident_lookup assume the directories have an associated task, and cannot currently be used on the /proc root directory because it does not have such a task. This small changes allows for base.c to be simplified and later when multiple pid spaces are introduced it makes getting the needed context information trivial. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/root.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 8901c65caca8..ffe66c38488b 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/bitops.h> 17#include <linux/bitops.h>
18#include <linux/smp_lock.h> 18#include <linux/smp_lock.h>
19#include <linux/mount.h>
19 20
20#include "internal.h" 21#include "internal.h"
21 22
@@ -28,6 +29,17 @@ struct proc_dir_entry *proc_sys_root;
28static int proc_get_sb(struct file_system_type *fs_type, 29static int proc_get_sb(struct file_system_type *fs_type,
29 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 30 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
30{ 31{
32 if (proc_mnt) {
33 /* Seed the root directory with a pid so it doesn't need
34 * to be special in base.c. I would do this earlier but
35 * the only task alive when /proc is mounted the first time
36 * is the init_task and it doesn't have any pids.
37 */
38 struct proc_inode *ei;
39 ei = PROC_I(proc_mnt->mnt_sb->s_root->d_inode);
40 if (!ei->pid)
41 ei->pid = find_get_pid(1);
42 }
31 return get_sb_single(fs_type, flags, data, proc_fill_super, mnt); 43 return get_sb_single(fs_type, flags, data, proc_fill_super, mnt);
32} 44}
33 45