diff options
Diffstat (limited to 'fs/proc/proc_misc.c')
-rw-r--r-- | fs/proc/proc_misc.c | 116 |
1 files changed, 57 insertions, 59 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 29e20c6b1f7..61b25f4eabe 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <linux/blkdev.h> | 45 | #include <linux/blkdev.h> |
46 | #include <linux/hugetlb.h> | 46 | #include <linux/hugetlb.h> |
47 | #include <linux/jiffies.h> | 47 | #include <linux/jiffies.h> |
48 | #include <linux/sysrq.h> | ||
49 | #include <linux/vmalloc.h> | 48 | #include <linux/vmalloc.h> |
50 | #include <linux/crash_dump.h> | 49 | #include <linux/crash_dump.h> |
51 | #include <linux/pid_namespace.h> | 50 | #include <linux/pid_namespace.h> |
@@ -68,7 +67,6 @@ | |||
68 | extern int get_hardware_list(char *); | 67 | extern int get_hardware_list(char *); |
69 | extern int get_stram_list(char *); | 68 | extern int get_stram_list(char *); |
70 | extern int get_exec_domain_list(char *); | 69 | extern int get_exec_domain_list(char *); |
71 | extern int get_dma_list(char *); | ||
72 | 70 | ||
73 | static int proc_calc_metrics(char *page, char **start, off_t off, | 71 | static int proc_calc_metrics(char *page, char **start, off_t off, |
74 | int count, int *eof, int len) | 72 | int count, int *eof, int len) |
@@ -138,6 +136,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
138 | unsigned long allowed; | 136 | unsigned long allowed; |
139 | struct vmalloc_info vmi; | 137 | struct vmalloc_info vmi; |
140 | long cached; | 138 | long cached; |
139 | unsigned long pages[NR_LRU_LISTS]; | ||
140 | int lru; | ||
141 | 141 | ||
142 | /* | 142 | /* |
143 | * display in kilobytes. | 143 | * display in kilobytes. |
@@ -156,51 +156,70 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
156 | 156 | ||
157 | get_vmalloc_info(&vmi); | 157 | get_vmalloc_info(&vmi); |
158 | 158 | ||
159 | for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++) | ||
160 | pages[lru] = global_page_state(NR_LRU_BASE + lru); | ||
161 | |||
159 | /* | 162 | /* |
160 | * Tagged format, for easy grepping and expansion. | 163 | * Tagged format, for easy grepping and expansion. |
161 | */ | 164 | */ |
162 | len = sprintf(page, | 165 | len = sprintf(page, |
163 | "MemTotal: %8lu kB\n" | 166 | "MemTotal: %8lu kB\n" |
164 | "MemFree: %8lu kB\n" | 167 | "MemFree: %8lu kB\n" |
165 | "Buffers: %8lu kB\n" | 168 | "Buffers: %8lu kB\n" |
166 | "Cached: %8lu kB\n" | 169 | "Cached: %8lu kB\n" |
167 | "SwapCached: %8lu kB\n" | 170 | "SwapCached: %8lu kB\n" |
168 | "Active: %8lu kB\n" | 171 | "Active: %8lu kB\n" |
169 | "Inactive: %8lu kB\n" | 172 | "Inactive: %8lu kB\n" |
173 | "Active(anon): %8lu kB\n" | ||
174 | "Inactive(anon): %8lu kB\n" | ||
175 | "Active(file): %8lu kB\n" | ||
176 | "Inactive(file): %8lu kB\n" | ||
177 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
178 | "Unevictable: %8lu kB\n" | ||
179 | "Mlocked: %8lu kB\n" | ||
180 | #endif | ||
170 | #ifdef CONFIG_HIGHMEM | 181 | #ifdef CONFIG_HIGHMEM |
171 | "HighTotal: %8lu kB\n" | 182 | "HighTotal: %8lu kB\n" |
172 | "HighFree: %8lu kB\n" | 183 | "HighFree: %8lu kB\n" |
173 | "LowTotal: %8lu kB\n" | 184 | "LowTotal: %8lu kB\n" |
174 | "LowFree: %8lu kB\n" | 185 | "LowFree: %8lu kB\n" |
175 | #endif | 186 | #endif |
176 | "SwapTotal: %8lu kB\n" | 187 | "SwapTotal: %8lu kB\n" |
177 | "SwapFree: %8lu kB\n" | 188 | "SwapFree: %8lu kB\n" |
178 | "Dirty: %8lu kB\n" | 189 | "Dirty: %8lu kB\n" |
179 | "Writeback: %8lu kB\n" | 190 | "Writeback: %8lu kB\n" |
180 | "AnonPages: %8lu kB\n" | 191 | "AnonPages: %8lu kB\n" |
181 | "Mapped: %8lu kB\n" | 192 | "Mapped: %8lu kB\n" |
182 | "Slab: %8lu kB\n" | 193 | "Slab: %8lu kB\n" |
183 | "SReclaimable: %8lu kB\n" | 194 | "SReclaimable: %8lu kB\n" |
184 | "SUnreclaim: %8lu kB\n" | 195 | "SUnreclaim: %8lu kB\n" |
185 | "PageTables: %8lu kB\n" | 196 | "PageTables: %8lu kB\n" |
186 | #ifdef CONFIG_QUICKLIST | 197 | #ifdef CONFIG_QUICKLIST |
187 | "Quicklists: %8lu kB\n" | 198 | "Quicklists: %8lu kB\n" |
188 | #endif | 199 | #endif |
189 | "NFS_Unstable: %8lu kB\n" | 200 | "NFS_Unstable: %8lu kB\n" |
190 | "Bounce: %8lu kB\n" | 201 | "Bounce: %8lu kB\n" |
191 | "WritebackTmp: %8lu kB\n" | 202 | "WritebackTmp: %8lu kB\n" |
192 | "CommitLimit: %8lu kB\n" | 203 | "CommitLimit: %8lu kB\n" |
193 | "Committed_AS: %8lu kB\n" | 204 | "Committed_AS: %8lu kB\n" |
194 | "VmallocTotal: %8lu kB\n" | 205 | "VmallocTotal: %8lu kB\n" |
195 | "VmallocUsed: %8lu kB\n" | 206 | "VmallocUsed: %8lu kB\n" |
196 | "VmallocChunk: %8lu kB\n", | 207 | "VmallocChunk: %8lu kB\n", |
197 | K(i.totalram), | 208 | K(i.totalram), |
198 | K(i.freeram), | 209 | K(i.freeram), |
199 | K(i.bufferram), | 210 | K(i.bufferram), |
200 | K(cached), | 211 | K(cached), |
201 | K(total_swapcache_pages), | 212 | K(total_swapcache_pages), |
202 | K(global_page_state(NR_ACTIVE)), | 213 | K(pages[LRU_ACTIVE_ANON] + pages[LRU_ACTIVE_FILE]), |
203 | K(global_page_state(NR_INACTIVE)), | 214 | K(pages[LRU_INACTIVE_ANON] + pages[LRU_INACTIVE_FILE]), |
215 | K(pages[LRU_ACTIVE_ANON]), | ||
216 | K(pages[LRU_INACTIVE_ANON]), | ||
217 | K(pages[LRU_ACTIVE_FILE]), | ||
218 | K(pages[LRU_INACTIVE_FILE]), | ||
219 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
220 | K(pages[LRU_UNEVICTABLE]), | ||
221 | K(global_page_state(NR_MLOCK)), | ||
222 | #endif | ||
204 | #ifdef CONFIG_HIGHMEM | 223 | #ifdef CONFIG_HIGHMEM |
205 | K(i.totalhigh), | 224 | K(i.totalhigh), |
206 | K(i.freehigh), | 225 | K(i.freehigh), |
@@ -684,6 +703,7 @@ static int cmdline_read_proc(char *page, char **start, off_t off, | |||
684 | return proc_calc_metrics(page, start, off, count, eof, len); | 703 | return proc_calc_metrics(page, start, off, count, eof, len); |
685 | } | 704 | } |
686 | 705 | ||
706 | #ifdef CONFIG_FILE_LOCKING | ||
687 | static int locks_open(struct inode *inode, struct file *filp) | 707 | static int locks_open(struct inode *inode, struct file *filp) |
688 | { | 708 | { |
689 | return seq_open(filp, &locks_seq_operations); | 709 | return seq_open(filp, &locks_seq_operations); |
@@ -695,6 +715,7 @@ static const struct file_operations proc_locks_operations = { | |||
695 | .llseek = seq_lseek, | 715 | .llseek = seq_lseek, |
696 | .release = seq_release, | 716 | .release = seq_release, |
697 | }; | 717 | }; |
718 | #endif /* CONFIG_FILE_LOCKING */ | ||
698 | 719 | ||
699 | static int execdomains_read_proc(char *page, char **start, off_t off, | 720 | static int execdomains_read_proc(char *page, char **start, off_t off, |
700 | int count, int *eof, void *data) | 721 | int count, int *eof, void *data) |
@@ -703,28 +724,6 @@ static int execdomains_read_proc(char *page, char **start, off_t off, | |||
703 | return proc_calc_metrics(page, start, off, count, eof, len); | 724 | return proc_calc_metrics(page, start, off, count, eof, len); |
704 | } | 725 | } |
705 | 726 | ||
706 | #ifdef CONFIG_MAGIC_SYSRQ | ||
707 | /* | ||
708 | * writing 'C' to /proc/sysrq-trigger is like sysrq-C | ||
709 | */ | ||
710 | static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf, | ||
711 | size_t count, loff_t *ppos) | ||
712 | { | ||
713 | if (count) { | ||
714 | char c; | ||
715 | |||
716 | if (get_user(c, buf)) | ||
717 | return -EFAULT; | ||
718 | __handle_sysrq(c, NULL, 0); | ||
719 | } | ||
720 | return count; | ||
721 | } | ||
722 | |||
723 | static const struct file_operations proc_sysrq_trigger_operations = { | ||
724 | .write = write_sysrq_trigger, | ||
725 | }; | ||
726 | #endif | ||
727 | |||
728 | #ifdef CONFIG_PROC_PAGE_MONITOR | 727 | #ifdef CONFIG_PROC_PAGE_MONITOR |
729 | #define KPMSIZE sizeof(u64) | 728 | #define KPMSIZE sizeof(u64) |
730 | #define KPMMASK (KPMSIZE - 1) | 729 | #define KPMMASK (KPMSIZE - 1) |
@@ -888,7 +887,9 @@ void __init proc_misc_init(void) | |||
888 | #ifdef CONFIG_PRINTK | 887 | #ifdef CONFIG_PRINTK |
889 | proc_create("kmsg", S_IRUSR, NULL, &proc_kmsg_operations); | 888 | proc_create("kmsg", S_IRUSR, NULL, &proc_kmsg_operations); |
890 | #endif | 889 | #endif |
890 | #ifdef CONFIG_FILE_LOCKING | ||
891 | proc_create("locks", 0, NULL, &proc_locks_operations); | 891 | proc_create("locks", 0, NULL, &proc_locks_operations); |
892 | #endif | ||
892 | proc_create("devices", 0, NULL, &proc_devinfo_operations); | 893 | proc_create("devices", 0, NULL, &proc_devinfo_operations); |
893 | proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations); | 894 | proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations); |
894 | #ifdef CONFIG_BLOCK | 895 | #ifdef CONFIG_BLOCK |
@@ -931,7 +932,4 @@ void __init proc_misc_init(void) | |||
931 | #ifdef CONFIG_PROC_VMCORE | 932 | #ifdef CONFIG_PROC_VMCORE |
932 | proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations); | 933 | proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations); |
933 | #endif | 934 | #endif |
934 | #ifdef CONFIG_MAGIC_SYSRQ | ||
935 | proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations); | ||
936 | #endif | ||
937 | } | 935 | } |