diff options
Diffstat (limited to 'fs/proc/kcore.c')
-rw-r--r-- | fs/proc/kcore.c | 14 |
1 files changed, 13 insertions, 1 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 | ||
30 | static struct proc_dir_entry *proc_root_kcore; | ||
31 | |||
30 | static int open_kcore(struct inode * inode, struct file * filp) | 32 | static 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 | ||
35 | static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *); | 37 | static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *); |
36 | 38 | ||
37 | const struct file_operations proc_kcore_operations = { | 39 | static 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 | |||
405 | static 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 | } | ||
413 | module_init(proc_kcore_init); | ||