aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/kcore.c14
-rw-r--r--fs/proc/proc_misc.c8
2 files changed, 13 insertions, 9 deletions
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index c2370c76fb71..59b43a068872 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -27,6 +27,8 @@
27#define ELF_CORE_EFLAGS 0 27#define ELF_CORE_EFLAGS 0
28#endif 28#endif
29 29
30static struct proc_dir_entry *proc_root_kcore;
31
30static int open_kcore(struct inode * inode, struct file * filp) 32static int open_kcore(struct inode * inode, struct file * filp)
31{ 33{
32 return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; 34 return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
@@ -34,7 +36,7 @@ static int open_kcore(struct inode * inode, struct file * filp)
34 36
35static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *); 37static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *);
36 38
37const struct file_operations proc_kcore_operations = { 39static const struct file_operations proc_kcore_operations = {
38 .read = read_kcore, 40 .read = read_kcore,
39 .open = open_kcore, 41 .open = open_kcore,
40}; 42};
@@ -399,3 +401,13 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
399 401
400 return acc; 402 return acc;
401} 403}
404
405static int __init proc_kcore_init(void)
406{
407 proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations);
408 if (proc_root_kcore)
409 proc_root_kcore->size =
410 (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
411 return 0;
412}
413module_init(proc_kcore_init);
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 4a768ed5da2e..5ed15ff8fd1d 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -188,19 +188,11 @@ static struct file_operations proc_kpageflags_operations = {
188}; 188};
189#endif /* CONFIG_PROC_PAGE_MONITOR */ 189#endif /* CONFIG_PROC_PAGE_MONITOR */
190 190
191struct proc_dir_entry *proc_root_kcore;
192
193void __init proc_misc_init(void) 191void __init proc_misc_init(void)
194{ 192{
195 proc_symlink("mounts", NULL, "self/mounts"); 193 proc_symlink("mounts", NULL, "self/mounts");
196 194
197 /* And now for trickier ones */ 195 /* And now for trickier ones */
198#ifdef CONFIG_PROC_KCORE
199 proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations);
200 if (proc_root_kcore)
201 proc_root_kcore->size =
202 (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
203#endif
204#ifdef CONFIG_PROC_PAGE_MONITOR 196#ifdef CONFIG_PROC_PAGE_MONITOR
205 proc_create("kpagecount", S_IRUSR, NULL, &proc_kpagecount_operations); 197 proc_create("kpagecount", S_IRUSR, NULL, &proc_kpagecount_operations);
206 proc_create("kpageflags", S_IRUSR, NULL, &proc_kpageflags_operations); 198 proc_create("kpageflags", S_IRUSR, NULL, &proc_kpageflags_operations);