diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-04 06:28:09 -0400 |
---|---|---|
committer | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-23 06:30:41 -0400 |
commit | 6e62775ece1c83a84d86df44cfd8ea3e6c96ce23 (patch) | |
tree | 2eac2401fd8ca9372e6b15cc656a87d0b75856fc /kernel | |
parent | cf9887f102541b8a0adb73f7da9c28d090622010 (diff) |
proc: move /proc/execdomains to kernel/exec_domain.c
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/exec_domain.c | 33 |
1 files changed, 27 insertions, 6 deletions
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) |