diff options
-rw-r--r-- | fs/proc/proc_misc.c | 9 | ||||
-rw-r--r-- | kernel/exec_domain.c | 33 |
2 files changed, 27 insertions, 15 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 15257d4b1b91..424b9d03b1a0 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -63,7 +63,6 @@ | |||
63 | * have a way to deal with that gracefully. Right now I used straightforward | 63 | * have a way to deal with that gracefully. Right now I used straightforward |
64 | * wrappers, but this needs further analysis wrt potential overflows. | 64 | * wrappers, but this needs further analysis wrt potential overflows. |
65 | */ | 65 | */ |
66 | extern int get_exec_domain_list(char *); | ||
67 | 66 | ||
68 | static int proc_calc_metrics(char *page, char **start, off_t off, | 67 | static int proc_calc_metrics(char *page, char **start, off_t off, |
69 | int count, int *eof, int len) | 68 | int count, int *eof, int len) |
@@ -486,13 +485,6 @@ static const struct file_operations proc_locks_operations = { | |||
486 | }; | 485 | }; |
487 | #endif /* CONFIG_FILE_LOCKING */ | 486 | #endif /* CONFIG_FILE_LOCKING */ |
488 | 487 | ||
489 | static int execdomains_read_proc(char *page, char **start, off_t off, | ||
490 | int count, int *eof, void *data) | ||
491 | { | ||
492 | int len = get_exec_domain_list(page); | ||
493 | return proc_calc_metrics(page, start, off, count, eof, len); | ||
494 | } | ||
495 | |||
496 | #ifdef CONFIG_PROC_PAGE_MONITOR | 488 | #ifdef CONFIG_PROC_PAGE_MONITOR |
497 | #define KPMSIZE sizeof(u64) | 489 | #define KPMSIZE sizeof(u64) |
498 | #define KPMMASK (KPMSIZE - 1) | 490 | #define KPMMASK (KPMSIZE - 1) |
@@ -632,7 +624,6 @@ void __init proc_misc_init(void) | |||
632 | char *name; | 624 | char *name; |
633 | int (*read_proc)(char*,char**,off_t,int,int*,void*); | 625 | int (*read_proc)(char*,char**,off_t,int,int*,void*); |
634 | } *p, simple_ones[] = { | 626 | } *p, simple_ones[] = { |
635 | {"execdomains", execdomains_read_proc}, | ||
636 | {NULL,} | 627 | {NULL,} |
637 | }; | 628 | }; |
638 | for (p = simple_ones; p->name; p++) | 629 | for (p = simple_ones; p->name; p++) |
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c index 0d407e886735..0511716e9424 100644 --- a/kernel/exec_domain.c +++ b/kernel/exec_domain.c | |||
@@ -12,7 +12,9 @@ | |||
12 | #include <linux/kmod.h> | 12 | #include <linux/kmod.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/personality.h> | 14 | #include <linux/personality.h> |
15 | #include <linux/proc_fs.h> | ||
15 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/seq_file.h> | ||
16 | #include <linux/syscalls.h> | 18 | #include <linux/syscalls.h> |
17 | #include <linux/sysctl.h> | 19 | #include <linux/sysctl.h> |
18 | #include <linux/types.h> | 20 | #include <linux/types.h> |
@@ -173,20 +175,39 @@ __set_personality(u_long personality) | |||
173 | return 0; | 175 | return 0; |
174 | } | 176 | } |
175 | 177 | ||
176 | int | 178 | #ifdef CONFIG_PROC_FS |
177 | get_exec_domain_list(char *page) | 179 | static int execdomains_proc_show(struct seq_file *m, void *v) |
178 | { | 180 | { |
179 | struct exec_domain *ep; | 181 | struct exec_domain *ep; |
180 | int len = 0; | ||
181 | 182 | ||
182 | read_lock(&exec_domains_lock); | 183 | read_lock(&exec_domains_lock); |
183 | for (ep = exec_domains; ep && len < PAGE_SIZE - 80; ep = ep->next) | 184 | for (ep = exec_domains; ep; ep = ep->next) |
184 | len += sprintf(page + len, "%d-%d\t%-16s\t[%s]\n", | 185 | seq_printf(m, "%d-%d\t%-16s\t[%s]\n", |
185 | ep->pers_low, ep->pers_high, ep->name, | 186 | ep->pers_low, ep->pers_high, ep->name, |
186 | module_name(ep->module)); | 187 | module_name(ep->module)); |
187 | read_unlock(&exec_domains_lock); | 188 | read_unlock(&exec_domains_lock); |
188 | return (len); | 189 | return 0; |
190 | } | ||
191 | |||
192 | static int execdomains_proc_open(struct inode *inode, struct file *file) | ||
193 | { | ||
194 | return single_open(file, execdomains_proc_show, NULL); | ||
195 | } | ||
196 | |||
197 | static const struct file_operations execdomains_proc_fops = { | ||
198 | .open = execdomains_proc_open, | ||
199 | .read = seq_read, | ||
200 | .llseek = seq_lseek, | ||
201 | .release = single_release, | ||
202 | }; | ||
203 | |||
204 | static int __init proc_execdomains_init(void) | ||
205 | { | ||
206 | proc_create("execdomains", 0, NULL, &execdomains_proc_fops); | ||
207 | return 0; | ||
189 | } | 208 | } |
209 | module_init(proc_execdomains_init); | ||
210 | #endif | ||
190 | 211 | ||
191 | asmlinkage long | 212 | asmlinkage long |
192 | sys_personality(u_long personality) | 213 | sys_personality(u_long personality) |