diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 15:04:37 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 15:04:37 -0400 |
| commit | 88ed86fee6651033de9b7038dac7869a9f19775a (patch) | |
| tree | 38b638d2e7cba110ec271275738f221feb7e0a37 /kernel | |
| parent | 3856d30ded1fe43c6657927ebad402d25cd128f4 (diff) | |
| parent | 59c7572e82d69483a66eaa67b46548baeb69ecf4 (diff) | |
Merge branch 'proc' of git://git.kernel.org/pub/scm/linux/kernel/git/adobriyan/proc
* 'proc' of git://git.kernel.org/pub/scm/linux/kernel/git/adobriyan/proc: (35 commits)
proc: remove fs/proc/proc_misc.c
proc: move /proc/vmcore creation to fs/proc/vmcore.c
proc: move pagecount stuff to fs/proc/page.c
proc: move all /proc/kcore stuff to fs/proc/kcore.c
proc: move /proc/schedstat boilerplate to kernel/sched_stats.h
proc: move /proc/modules boilerplate to kernel/module.c
proc: move /proc/diskstats boilerplate to block/genhd.c
proc: move /proc/zoneinfo boilerplate to mm/vmstat.c
proc: move /proc/vmstat boilerplate to mm/vmstat.c
proc: move /proc/pagetypeinfo boilerplate to mm/vmstat.c
proc: move /proc/buddyinfo boilerplate to mm/vmstat.c
proc: move /proc/vmallocinfo to mm/vmalloc.c
proc: move /proc/slabinfo boilerplate to mm/slub.c, mm/slab.c
proc: move /proc/slab_allocators boilerplate to mm/slab.c
proc: move /proc/interrupts boilerplate code to fs/proc/interrupts.c
proc: move /proc/stat to fs/proc/stat.c
proc: move rest of /proc/partitions code to block/genhd.c
proc: move /proc/cpuinfo code to fs/proc/cpuinfo.c
proc: move /proc/devices code to fs/proc/devices.c
proc: move rest of /proc/locks to fs/locks.c
...
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/exec_domain.c | 33 | ||||
| -rw-r--r-- | kernel/module.c | 59 | ||||
| -rw-r--r-- | kernel/sched.c | 1 | ||||
| -rw-r--r-- | kernel/sched_stats.h | 9 |
4 files changed, 77 insertions, 25 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) |
diff --git a/kernel/module.c b/kernel/module.c index c0f1826e2d9e..1f4cc00e0c20 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -20,11 +20,13 @@ | |||
| 20 | #include <linux/moduleloader.h> | 20 | #include <linux/moduleloader.h> |
| 21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
| 22 | #include <linux/kallsyms.h> | 22 | #include <linux/kallsyms.h> |
| 23 | #include <linux/fs.h> | ||
| 23 | #include <linux/sysfs.h> | 24 | #include <linux/sysfs.h> |
| 24 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
| 25 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
| 26 | #include <linux/vmalloc.h> | 27 | #include <linux/vmalloc.h> |
| 27 | #include <linux/elf.h> | 28 | #include <linux/elf.h> |
| 29 | #include <linux/proc_fs.h> | ||
| 28 | #include <linux/seq_file.h> | 30 | #include <linux/seq_file.h> |
| 29 | #include <linux/syscalls.h> | 31 | #include <linux/syscalls.h> |
| 30 | #include <linux/fcntl.h> | 32 | #include <linux/fcntl.h> |
| @@ -2556,23 +2558,6 @@ unsigned long module_kallsyms_lookup_name(const char *name) | |||
| 2556 | } | 2558 | } |
| 2557 | #endif /* CONFIG_KALLSYMS */ | 2559 | #endif /* CONFIG_KALLSYMS */ |
| 2558 | 2560 | ||
| 2559 | /* Called by the /proc file system to return a list of modules. */ | ||
| 2560 | static void *m_start(struct seq_file *m, loff_t *pos) | ||
| 2561 | { | ||
| 2562 | mutex_lock(&module_mutex); | ||
| 2563 | return seq_list_start(&modules, *pos); | ||
| 2564 | } | ||
| 2565 | |||
| 2566 | static void *m_next(struct seq_file *m, void *p, loff_t *pos) | ||
| 2567 | { | ||
| 2568 | return seq_list_next(p, &modules, pos); | ||
| 2569 | } | ||
| 2570 | |||
| 2571 | static void m_stop(struct seq_file *m, void *p) | ||
| 2572 | { | ||
| 2573 | mutex_unlock(&module_mutex); | ||
| 2574 | } | ||
| 2575 | |||
| 2576 | static char *module_flags(struct module *mod, char *buf) | 2561 | static char *module_flags(struct module *mod, char *buf) |
| 2577 | { | 2562 | { |
| 2578 | int bx = 0; | 2563 | int bx = 0; |
| @@ -2606,6 +2591,24 @@ static char *module_flags(struct module *mod, char *buf) | |||
| 2606 | return buf; | 2591 | return buf; |
| 2607 | } | 2592 | } |
| 2608 | 2593 | ||
| 2594 | #ifdef CONFIG_PROC_FS | ||
| 2595 | /* Called by the /proc file system to return a list of modules. */ | ||
| 2596 | static void *m_start(struct seq_file *m, loff_t *pos) | ||
| 2597 | { | ||
| 2598 | mutex_lock(&module_mutex); | ||
| 2599 | return seq_list_start(&modules, *pos); | ||
| 2600 | } | ||
| 2601 | |||
| 2602 | static void *m_next(struct seq_file *m, void *p, loff_t *pos) | ||
| 2603 | { | ||
| 2604 | return seq_list_next(p, &modules, pos); | ||
| 2605 | } | ||
| 2606 | |||
| 2607 | static void m_stop(struct seq_file *m, void *p) | ||
| 2608 | { | ||
| 2609 | mutex_unlock(&module_mutex); | ||
| 2610 | } | ||
| 2611 | |||
| 2609 | static int m_show(struct seq_file *m, void *p) | 2612 | static int m_show(struct seq_file *m, void *p) |
| 2610 | { | 2613 | { |
| 2611 | struct module *mod = list_entry(p, struct module, list); | 2614 | struct module *mod = list_entry(p, struct module, list); |
| @@ -2636,13 +2639,33 @@ static int m_show(struct seq_file *m, void *p) | |||
| 2636 | Where refcount is a number or -, and deps is a comma-separated list | 2639 | Where refcount is a number or -, and deps is a comma-separated list |
| 2637 | of depends or -. | 2640 | of depends or -. |
| 2638 | */ | 2641 | */ |
| 2639 | const struct seq_operations modules_op = { | 2642 | static const struct seq_operations modules_op = { |
| 2640 | .start = m_start, | 2643 | .start = m_start, |
| 2641 | .next = m_next, | 2644 | .next = m_next, |
| 2642 | .stop = m_stop, | 2645 | .stop = m_stop, |
| 2643 | .show = m_show | 2646 | .show = m_show |
| 2644 | }; | 2647 | }; |
| 2645 | 2648 | ||
| 2649 | static int modules_open(struct inode *inode, struct file *file) | ||
| 2650 | { | ||
| 2651 | return seq_open(file, &modules_op); | ||
| 2652 | } | ||
| 2653 | |||
| 2654 | static const struct file_operations proc_modules_operations = { | ||
| 2655 | .open = modules_open, | ||
| 2656 | .read = seq_read, | ||
| 2657 | .llseek = seq_lseek, | ||
| 2658 | .release = seq_release, | ||
| 2659 | }; | ||
| 2660 | |||
| 2661 | static int __init proc_modules_init(void) | ||
| 2662 | { | ||
| 2663 | proc_create("modules", 0, NULL, &proc_modules_operations); | ||
| 2664 | return 0; | ||
| 2665 | } | ||
| 2666 | module_init(proc_modules_init); | ||
| 2667 | #endif | ||
| 2668 | |||
| 2646 | /* Given an address, look for it in the module exception tables. */ | 2669 | /* Given an address, look for it in the module exception tables. */ |
| 2647 | const struct exception_table_entry *search_module_extables(unsigned long addr) | 2670 | const struct exception_table_entry *search_module_extables(unsigned long addr) |
| 2648 | { | 2671 | { |
diff --git a/kernel/sched.c b/kernel/sched.c index 1645c7211944..6625c3c4b10d 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -55,6 +55,7 @@ | |||
| 55 | #include <linux/cpuset.h> | 55 | #include <linux/cpuset.h> |
| 56 | #include <linux/percpu.h> | 56 | #include <linux/percpu.h> |
| 57 | #include <linux/kthread.h> | 57 | #include <linux/kthread.h> |
| 58 | #include <linux/proc_fs.h> | ||
| 58 | #include <linux/seq_file.h> | 59 | #include <linux/seq_file.h> |
| 59 | #include <linux/sysctl.h> | 60 | #include <linux/sysctl.h> |
| 60 | #include <linux/syscalls.h> | 61 | #include <linux/syscalls.h> |
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h index 2df9d297d292..ee71bec1da66 100644 --- a/kernel/sched_stats.h +++ b/kernel/sched_stats.h | |||
| @@ -90,13 +90,20 @@ static int schedstat_open(struct inode *inode, struct file *file) | |||
| 90 | return res; | 90 | return res; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | const struct file_operations proc_schedstat_operations = { | 93 | static const struct file_operations proc_schedstat_operations = { |
| 94 | .open = schedstat_open, | 94 | .open = schedstat_open, |
| 95 | .read = seq_read, | 95 | .read = seq_read, |
| 96 | .llseek = seq_lseek, | 96 | .llseek = seq_lseek, |
| 97 | .release = single_release, | 97 | .release = single_release, |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | static int __init proc_schedstat_init(void) | ||
| 101 | { | ||
| 102 | proc_create("schedstat", 0, NULL, &proc_schedstat_operations); | ||
| 103 | return 0; | ||
| 104 | } | ||
| 105 | module_init(proc_schedstat_init); | ||
| 106 | |||
| 100 | /* | 107 | /* |
| 101 | * Expects runqueue lock to be held for atomicity of update | 108 | * Expects runqueue lock to be held for atomicity of update |
| 102 | */ | 109 | */ |
