Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/fs/proc/proc_misc.c |
| 3 | * |
| 4 | * linux/fs/proc/array.c |
| 5 | * Copyright (C) 1992 by Linus Torvalds |
| 6 | * based on ideas by Darren Senn |
| 7 | * |
| 8 | * This used to be the part of array.c. See the rest of history and credits |
| 9 | * there. I took this into a separate file and switched the thing to generic |
| 10 | * proc_file_inode_operations, leaving in array.c only per-process stuff. |
| 11 | * Inumbers allocation made dynamic (via create_proc_entry()). AV, May 1999. |
| 12 | * |
| 13 | * Changes: |
| 14 | * Fulton Green : Encapsulated position metric calculations. |
| 15 | * <kernel@FultonGreen.com> |
| 16 | */ |
| 17 | |
| 18 | #include <linux/types.h> |
| 19 | #include <linux/errno.h> |
| 20 | #include <linux/time.h> |
| 21 | #include <linux/kernel.h> |
| 22 | #include <linux/kernel_stat.h> |
Neil Horman | 7170be5 | 2006-01-14 13:20:38 -0800 | [diff] [blame] | 23 | #include <linux/fs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | #include <linux/tty.h> |
| 25 | #include <linux/string.h> |
| 26 | #include <linux/mman.h> |
KOSAKI Motohiro | 4b85615 | 2008-09-02 14:35:53 -0700 | [diff] [blame] | 27 | #include <linux/quicklist.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | #include <linux/proc_fs.h> |
| 29 | #include <linux/ioport.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #include <linux/mm.h> |
| 31 | #include <linux/mmzone.h> |
| 32 | #include <linux/pagemap.h> |
Yinghai Lu | c7fb03a | 2008-08-19 20:50:12 -0700 | [diff] [blame] | 33 | #include <linux/irq.h> |
Adrian Bunk | f74596d | 2008-02-06 01:36:35 -0800 | [diff] [blame] | 34 | #include <linux/interrupt.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | #include <linux/swap.h> |
| 36 | #include <linux/slab.h> |
Adrian Bunk | a0db701 | 2008-03-04 11:23:50 +0100 | [diff] [blame] | 37 | #include <linux/genhd.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | #include <linux/smp.h> |
| 39 | #include <linux/signal.h> |
| 40 | #include <linux/module.h> |
| 41 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | #include <linux/seq_file.h> |
| 43 | #include <linux/times.h> |
| 44 | #include <linux/profile.h> |
Andrew Morton | 7bf6538 | 2006-12-08 02:41:14 -0800 | [diff] [blame] | 45 | #include <linux/utsname.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | #include <linux/blkdev.h> |
| 47 | #include <linux/hugetlb.h> |
| 48 | #include <linux/jiffies.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #include <linux/vmalloc.h> |
Vivek Goyal | 666bfdd | 2005-06-25 14:58:21 -0700 | [diff] [blame] | 50 | #include <linux/crash_dump.h> |
Sukadev Bhattiprolu | 61a58c6 | 2006-12-08 02:37:58 -0800 | [diff] [blame] | 51 | #include <linux/pid_namespace.h> |
Matt Mackall | 161f47b | 2008-02-04 22:29:05 -0800 | [diff] [blame] | 52 | #include <linux/bootmem.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | #include <asm/uaccess.h> |
| 54 | #include <asm/pgtable.h> |
| 55 | #include <asm/io.h> |
| 56 | #include <asm/tlb.h> |
| 57 | #include <asm/div64.h> |
| 58 | #include "internal.h" |
| 59 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | /* |
| 61 | * Warning: stuff below (imported functions) assumes that its output will fit |
| 62 | * into one page. For some of those functions it may be wrong. Moreover, we |
| 63 | * have a way to deal with that gracefully. Right now I used straightforward |
| 64 | * wrappers, but this needs further analysis wrt potential overflows. |
| 65 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | extern int get_stram_list(char *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | extern int get_exec_domain_list(char *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
| 69 | static int proc_calc_metrics(char *page, char **start, off_t off, |
| 70 | int count, int *eof, int len) |
| 71 | { |
| 72 | if (len <= off+count) *eof = 1; |
| 73 | *start = page + off; |
| 74 | len -= off; |
| 75 | if (len>count) len = count; |
| 76 | if (len<0) len = 0; |
| 77 | return len; |
| 78 | } |
| 79 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | static int fragmentation_open(struct inode *inode, struct file *file) |
| 81 | { |
| 82 | (void)inode; |
| 83 | return seq_open(file, &fragmentation_op); |
| 84 | } |
| 85 | |
Arjan van de Ven | 00977a5 | 2007-02-12 00:55:34 -0800 | [diff] [blame] | 86 | static const struct file_operations fragmentation_file_operations = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | .open = fragmentation_open, |
| 88 | .read = seq_read, |
| 89 | .llseek = seq_lseek, |
| 90 | .release = seq_release, |
| 91 | }; |
| 92 | |
Mel Gorman | 467c996 | 2007-10-16 01:26:02 -0700 | [diff] [blame] | 93 | static int pagetypeinfo_open(struct inode *inode, struct file *file) |
| 94 | { |
| 95 | return seq_open(file, &pagetypeinfo_op); |
| 96 | } |
| 97 | |
| 98 | static const struct file_operations pagetypeinfo_file_ops = { |
| 99 | .open = pagetypeinfo_open, |
| 100 | .read = seq_read, |
| 101 | .llseek = seq_lseek, |
| 102 | .release = seq_release, |
| 103 | }; |
| 104 | |
Nikita Danilov | 295ab93 | 2005-06-21 17:14:38 -0700 | [diff] [blame] | 105 | static int zoneinfo_open(struct inode *inode, struct file *file) |
| 106 | { |
| 107 | return seq_open(file, &zoneinfo_op); |
| 108 | } |
| 109 | |
Arjan van de Ven | 00977a5 | 2007-02-12 00:55:34 -0800 | [diff] [blame] | 110 | static const struct file_operations proc_zoneinfo_file_operations = { |
Nikita Danilov | 295ab93 | 2005-06-21 17:14:38 -0700 | [diff] [blame] | 111 | .open = zoneinfo_open, |
| 112 | .read = seq_read, |
| 113 | .llseek = seq_lseek, |
| 114 | .release = seq_release, |
| 115 | }; |
| 116 | |
Jan Engelhardt | 03a4482 | 2008-02-08 04:21:19 -0800 | [diff] [blame] | 117 | extern const struct seq_operations cpuinfo_op; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | static int cpuinfo_open(struct inode *inode, struct file *file) |
| 119 | { |
| 120 | return seq_open(file, &cpuinfo_op); |
| 121 | } |
Neil Horman | 7170be5 | 2006-01-14 13:20:38 -0800 | [diff] [blame] | 122 | |
Arjan van de Ven | 00977a5 | 2007-02-12 00:55:34 -0800 | [diff] [blame] | 123 | static const struct file_operations proc_cpuinfo_operations = { |
Joe Korty | 68eef3b | 2006-03-31 02:30:32 -0800 | [diff] [blame] | 124 | .open = cpuinfo_open, |
Neil Horman | 7170be5 | 2006-01-14 13:20:38 -0800 | [diff] [blame] | 125 | .read = seq_read, |
| 126 | .llseek = seq_lseek, |
| 127 | .release = seq_release, |
| 128 | }; |
| 129 | |
Joe Korty | 68eef3b | 2006-03-31 02:30:32 -0800 | [diff] [blame] | 130 | static int devinfo_show(struct seq_file *f, void *v) |
| 131 | { |
| 132 | int i = *(loff_t *) v; |
| 133 | |
| 134 | if (i < CHRDEV_MAJOR_HASH_SIZE) { |
| 135 | if (i == 0) |
| 136 | seq_printf(f, "Character devices:\n"); |
| 137 | chrdev_show(f, i); |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 138 | } |
| 139 | #ifdef CONFIG_BLOCK |
| 140 | else { |
Joe Korty | 68eef3b | 2006-03-31 02:30:32 -0800 | [diff] [blame] | 141 | i -= CHRDEV_MAJOR_HASH_SIZE; |
| 142 | if (i == 0) |
| 143 | seq_printf(f, "\nBlock devices:\n"); |
| 144 | blkdev_show(f, i); |
| 145 | } |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 146 | #endif |
Joe Korty | 68eef3b | 2006-03-31 02:30:32 -0800 | [diff] [blame] | 147 | return 0; |
| 148 | } |
| 149 | |
| 150 | static void *devinfo_start(struct seq_file *f, loff_t *pos) |
| 151 | { |
| 152 | if (*pos < (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE)) |
| 153 | return pos; |
| 154 | return NULL; |
| 155 | } |
| 156 | |
| 157 | static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos) |
| 158 | { |
| 159 | (*pos)++; |
| 160 | if (*pos >= (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE)) |
| 161 | return NULL; |
| 162 | return pos; |
| 163 | } |
| 164 | |
| 165 | static void devinfo_stop(struct seq_file *f, void *v) |
| 166 | { |
| 167 | /* Nothing to do */ |
| 168 | } |
| 169 | |
Jan Engelhardt | 03a4482 | 2008-02-08 04:21:19 -0800 | [diff] [blame] | 170 | static const struct seq_operations devinfo_ops = { |
Joe Korty | 68eef3b | 2006-03-31 02:30:32 -0800 | [diff] [blame] | 171 | .start = devinfo_start, |
| 172 | .next = devinfo_next, |
| 173 | .stop = devinfo_stop, |
| 174 | .show = devinfo_show |
| 175 | }; |
| 176 | |
| 177 | static int devinfo_open(struct inode *inode, struct file *filp) |
| 178 | { |
| 179 | return seq_open(filp, &devinfo_ops); |
| 180 | } |
| 181 | |
Arjan van de Ven | 00977a5 | 2007-02-12 00:55:34 -0800 | [diff] [blame] | 182 | static const struct file_operations proc_devinfo_operations = { |
Joe Korty | 68eef3b | 2006-03-31 02:30:32 -0800 | [diff] [blame] | 183 | .open = devinfo_open, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | .read = seq_read, |
| 185 | .llseek = seq_lseek, |
| 186 | .release = seq_release, |
| 187 | }; |
| 188 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | static int vmstat_open(struct inode *inode, struct file *file) |
| 190 | { |
| 191 | return seq_open(file, &vmstat_op); |
| 192 | } |
Arjan van de Ven | 00977a5 | 2007-02-12 00:55:34 -0800 | [diff] [blame] | 193 | static const struct file_operations proc_vmstat_file_operations = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | .open = vmstat_open, |
| 195 | .read = seq_read, |
| 196 | .llseek = seq_lseek, |
| 197 | .release = seq_release, |
| 198 | }; |
| 199 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | #ifdef CONFIG_STRAM_PROC |
| 201 | static int stram_read_proc(char *page, char **start, off_t off, |
| 202 | int count, int *eof, void *data) |
| 203 | { |
| 204 | int len = get_stram_list(page); |
| 205 | return proc_calc_metrics(page, start, off, count, eof, len); |
| 206 | } |
| 207 | #endif |
| 208 | |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 209 | #ifdef CONFIG_BLOCK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | static int partitions_open(struct inode *inode, struct file *file) |
| 211 | { |
| 212 | return seq_open(file, &partitions_op); |
| 213 | } |
Arjan van de Ven | 00977a5 | 2007-02-12 00:55:34 -0800 | [diff] [blame] | 214 | static const struct file_operations proc_partitions_operations = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | .open = partitions_open, |
| 216 | .read = seq_read, |
| 217 | .llseek = seq_lseek, |
| 218 | .release = seq_release, |
| 219 | }; |
| 220 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | static int diskstats_open(struct inode *inode, struct file *file) |
| 222 | { |
| 223 | return seq_open(file, &diskstats_op); |
| 224 | } |
Arjan van de Ven | 00977a5 | 2007-02-12 00:55:34 -0800 | [diff] [blame] | 225 | static const struct file_operations proc_diskstats_operations = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | .open = diskstats_open, |
| 227 | .read = seq_read, |
| 228 | .llseek = seq_lseek, |
| 229 | .release = seq_release, |
| 230 | }; |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 231 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | |
| 233 | #ifdef CONFIG_MODULES |
Jan Engelhardt | 03a4482 | 2008-02-08 04:21:19 -0800 | [diff] [blame] | 234 | extern const struct seq_operations modules_op; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | static int modules_open(struct inode *inode, struct file *file) |
| 236 | { |
| 237 | return seq_open(file, &modules_op); |
| 238 | } |
Arjan van de Ven | 00977a5 | 2007-02-12 00:55:34 -0800 | [diff] [blame] | 239 | static const struct file_operations proc_modules_operations = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | .open = modules_open, |
| 241 | .read = seq_read, |
| 242 | .llseek = seq_lseek, |
| 243 | .release = seq_release, |
| 244 | }; |
| 245 | #endif |
| 246 | |
Linus Torvalds | 158a962 | 2008-01-02 13:04:48 -0800 | [diff] [blame] | 247 | #ifdef CONFIG_SLABINFO |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | static int slabinfo_open(struct inode *inode, struct file *file) |
| 249 | { |
| 250 | return seq_open(file, &slabinfo_op); |
| 251 | } |
Arjan van de Ven | 00977a5 | 2007-02-12 00:55:34 -0800 | [diff] [blame] | 252 | static const struct file_operations proc_slabinfo_operations = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | .open = slabinfo_open, |
| 254 | .read = seq_read, |
| 255 | .write = slabinfo_write, |
| 256 | .llseek = seq_lseek, |
| 257 | .release = seq_release, |
| 258 | }; |
Al Viro | 871751e | 2006-03-25 03:06:39 -0800 | [diff] [blame] | 259 | |
| 260 | #ifdef CONFIG_DEBUG_SLAB_LEAK |
Jan Engelhardt | 03a4482 | 2008-02-08 04:21:19 -0800 | [diff] [blame] | 261 | extern const struct seq_operations slabstats_op; |
Al Viro | 871751e | 2006-03-25 03:06:39 -0800 | [diff] [blame] | 262 | static int slabstats_open(struct inode *inode, struct file *file) |
| 263 | { |
| 264 | unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL); |
| 265 | int ret = -ENOMEM; |
| 266 | if (n) { |
| 267 | ret = seq_open(file, &slabstats_op); |
| 268 | if (!ret) { |
| 269 | struct seq_file *m = file->private_data; |
| 270 | *n = PAGE_SIZE / (2 * sizeof(unsigned long)); |
| 271 | m->private = n; |
| 272 | n = NULL; |
| 273 | } |
| 274 | kfree(n); |
| 275 | } |
| 276 | return ret; |
| 277 | } |
| 278 | |
Arjan van de Ven | 00977a5 | 2007-02-12 00:55:34 -0800 | [diff] [blame] | 279 | static const struct file_operations proc_slabstats_operations = { |
Al Viro | 871751e | 2006-03-25 03:06:39 -0800 | [diff] [blame] | 280 | .open = slabstats_open, |
| 281 | .read = seq_read, |
| 282 | .llseek = seq_lseek, |
Martin Peschke | 09f0892 | 2007-05-08 00:29:26 -0700 | [diff] [blame] | 283 | .release = seq_release_private, |
Al Viro | 871751e | 2006-03-25 03:06:39 -0800 | [diff] [blame] | 284 | }; |
| 285 | #endif |
Matt Mackall | 10cef60 | 2006-01-08 01:01:45 -0800 | [diff] [blame] | 286 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | |
Christoph Lameter | a10aa57 | 2008-04-28 02:12:40 -0700 | [diff] [blame] | 288 | #ifdef CONFIG_MMU |
| 289 | static int vmalloc_open(struct inode *inode, struct file *file) |
| 290 | { |
Eric Dumazet | a47a126 | 2008-07-23 21:27:38 -0700 | [diff] [blame] | 291 | unsigned int *ptr = NULL; |
| 292 | int ret; |
| 293 | |
| 294 | if (NUMA_BUILD) |
| 295 | ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL); |
| 296 | ret = seq_open(file, &vmalloc_op); |
| 297 | if (!ret) { |
| 298 | struct seq_file *m = file->private_data; |
| 299 | m->private = ptr; |
| 300 | } else |
| 301 | kfree(ptr); |
| 302 | return ret; |
Christoph Lameter | a10aa57 | 2008-04-28 02:12:40 -0700 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | static const struct file_operations proc_vmalloc_operations = { |
| 306 | .open = vmalloc_open, |
| 307 | .read = seq_read, |
| 308 | .llseek = seq_lseek, |
Eric Dumazet | a47a126 | 2008-07-23 21:27:38 -0700 | [diff] [blame] | 309 | .release = seq_release_private, |
Christoph Lameter | a10aa57 | 2008-04-28 02:12:40 -0700 | [diff] [blame] | 310 | }; |
| 311 | #endif |
| 312 | |
Jan Beulich | a2eddfa | 2008-05-12 15:44:41 +0200 | [diff] [blame] | 313 | #ifndef arch_irq_stat_cpu |
| 314 | #define arch_irq_stat_cpu(cpu) 0 |
| 315 | #endif |
| 316 | #ifndef arch_irq_stat |
| 317 | #define arch_irq_stat() 0 |
| 318 | #endif |
| 319 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | static int show_stat(struct seq_file *p, void *v) |
| 321 | { |
Yinghai Lu | c7fb03a | 2008-08-19 20:50:12 -0700 | [diff] [blame] | 322 | int i, j; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | unsigned long jif; |
| 324 | cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; |
Laurent Vivier | 5e84cfd | 2007-10-15 17:00:19 +0200 | [diff] [blame] | 325 | cputime64_t guest; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | u64 sum = 0; |
Tomas Janousek | 924b42d | 2007-07-15 23:39:42 -0700 | [diff] [blame] | 327 | struct timespec boottime; |
Yinghai Lu | c7fb03a | 2008-08-19 20:50:12 -0700 | [diff] [blame] | 328 | unsigned int per_irq_sum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | |
| 330 | user = nice = system = idle = iowait = |
| 331 | irq = softirq = steal = cputime64_zero; |
Laurent Vivier | 5e84cfd | 2007-10-15 17:00:19 +0200 | [diff] [blame] | 332 | guest = cputime64_zero; |
Tomas Janousek | 924b42d | 2007-07-15 23:39:42 -0700 | [diff] [blame] | 333 | getboottime(&boottime); |
| 334 | jif = boottime.tv_sec; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | |
KAMEZAWA Hiroyuki | 0a94502 | 2006-03-28 01:56:37 -0800 | [diff] [blame] | 336 | for_each_possible_cpu(i) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | user = cputime64_add(user, kstat_cpu(i).cpustat.user); |
| 338 | nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); |
| 339 | system = cputime64_add(system, kstat_cpu(i).cpustat.system); |
| 340 | idle = cputime64_add(idle, kstat_cpu(i).cpustat.idle); |
| 341 | iowait = cputime64_add(iowait, kstat_cpu(i).cpustat.iowait); |
| 342 | irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq); |
| 343 | softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); |
| 344 | steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); |
Laurent Vivier | 5e84cfd | 2007-10-15 17:00:19 +0200 | [diff] [blame] | 345 | guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest); |
Yinghai Lu | c7fb03a | 2008-08-19 20:50:12 -0700 | [diff] [blame] | 346 | |
Thomas Gleixner | 2be3b52 | 2008-10-16 14:50:27 +0200 | [diff] [blame] | 347 | for_each_irq_nr(j) |
Thomas Gleixner | 2cc21ef | 2008-10-15 14:16:55 +0200 | [diff] [blame] | 348 | sum += kstat_irqs_cpu(j, i); |
| 349 | |
Jan Beulich | a2eddfa | 2008-05-12 15:44:41 +0200 | [diff] [blame] | 350 | sum += arch_irq_stat_cpu(i); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | } |
Jan Beulich | a2eddfa | 2008-05-12 15:44:41 +0200 | [diff] [blame] | 352 | sum += arch_irq_stat(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | |
Laurent Vivier | 5e84cfd | 2007-10-15 17:00:19 +0200 | [diff] [blame] | 354 | seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | (unsigned long long)cputime64_to_clock_t(user), |
| 356 | (unsigned long long)cputime64_to_clock_t(nice), |
| 357 | (unsigned long long)cputime64_to_clock_t(system), |
| 358 | (unsigned long long)cputime64_to_clock_t(idle), |
| 359 | (unsigned long long)cputime64_to_clock_t(iowait), |
| 360 | (unsigned long long)cputime64_to_clock_t(irq), |
| 361 | (unsigned long long)cputime64_to_clock_t(softirq), |
Laurent Vivier | 5e84cfd | 2007-10-15 17:00:19 +0200 | [diff] [blame] | 362 | (unsigned long long)cputime64_to_clock_t(steal), |
| 363 | (unsigned long long)cputime64_to_clock_t(guest)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | for_each_online_cpu(i) { |
| 365 | |
| 366 | /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ |
| 367 | user = kstat_cpu(i).cpustat.user; |
| 368 | nice = kstat_cpu(i).cpustat.nice; |
| 369 | system = kstat_cpu(i).cpustat.system; |
| 370 | idle = kstat_cpu(i).cpustat.idle; |
| 371 | iowait = kstat_cpu(i).cpustat.iowait; |
| 372 | irq = kstat_cpu(i).cpustat.irq; |
| 373 | softirq = kstat_cpu(i).cpustat.softirq; |
| 374 | steal = kstat_cpu(i).cpustat.steal; |
Laurent Vivier | 5e84cfd | 2007-10-15 17:00:19 +0200 | [diff] [blame] | 375 | guest = kstat_cpu(i).cpustat.guest; |
| 376 | seq_printf(p, |
| 377 | "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | i, |
| 379 | (unsigned long long)cputime64_to_clock_t(user), |
| 380 | (unsigned long long)cputime64_to_clock_t(nice), |
| 381 | (unsigned long long)cputime64_to_clock_t(system), |
| 382 | (unsigned long long)cputime64_to_clock_t(idle), |
| 383 | (unsigned long long)cputime64_to_clock_t(iowait), |
| 384 | (unsigned long long)cputime64_to_clock_t(irq), |
| 385 | (unsigned long long)cputime64_to_clock_t(softirq), |
Laurent Vivier | 5e84cfd | 2007-10-15 17:00:19 +0200 | [diff] [blame] | 386 | (unsigned long long)cputime64_to_clock_t(steal), |
| 387 | (unsigned long long)cputime64_to_clock_t(guest)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | } |
| 389 | seq_printf(p, "intr %llu", (unsigned long long)sum); |
| 390 | |
Yinghai Lu | c7fb03a | 2008-08-19 20:50:12 -0700 | [diff] [blame] | 391 | /* sum again ? it could be updated? */ |
Thomas Gleixner | 2be3b52 | 2008-10-16 14:50:27 +0200 | [diff] [blame] | 392 | for_each_irq_nr(j) { |
Yinghai Lu | c7fb03a | 2008-08-19 20:50:12 -0700 | [diff] [blame] | 393 | per_irq_sum = 0; |
Yinghai Lu | c7fb03a | 2008-08-19 20:50:12 -0700 | [diff] [blame] | 394 | |
Thomas Gleixner | 2cc21ef | 2008-10-15 14:16:55 +0200 | [diff] [blame] | 395 | for_each_possible_cpu(i) |
| 396 | per_irq_sum += kstat_irqs_cpu(j, i); |
Yinghai Lu | c7fb03a | 2008-08-19 20:50:12 -0700 | [diff] [blame] | 397 | |
Yinghai Lu | c7fb03a | 2008-08-19 20:50:12 -0700 | [diff] [blame] | 398 | seq_printf(p, " %u", per_irq_sum); |
Yinghai Lu | c7fb03a | 2008-08-19 20:50:12 -0700 | [diff] [blame] | 399 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | |
| 401 | seq_printf(p, |
| 402 | "\nctxt %llu\n" |
| 403 | "btime %lu\n" |
| 404 | "processes %lu\n" |
| 405 | "procs_running %lu\n" |
| 406 | "procs_blocked %lu\n", |
| 407 | nr_context_switches(), |
| 408 | (unsigned long)jif, |
| 409 | total_forks, |
| 410 | nr_running(), |
| 411 | nr_iowait()); |
| 412 | |
| 413 | return 0; |
| 414 | } |
| 415 | |
| 416 | static int stat_open(struct inode *inode, struct file *file) |
| 417 | { |
| 418 | unsigned size = 4096 * (1 + num_possible_cpus() / 32); |
| 419 | char *buf; |
| 420 | struct seq_file *m; |
| 421 | int res; |
| 422 | |
| 423 | /* don't ask for more than the kmalloc() max size, currently 128 KB */ |
| 424 | if (size > 128 * 1024) |
| 425 | size = 128 * 1024; |
| 426 | buf = kmalloc(size, GFP_KERNEL); |
| 427 | if (!buf) |
| 428 | return -ENOMEM; |
| 429 | |
| 430 | res = single_open(file, show_stat, NULL); |
| 431 | if (!res) { |
| 432 | m = file->private_data; |
| 433 | m->buf = buf; |
| 434 | m->size = size; |
| 435 | } else |
| 436 | kfree(buf); |
| 437 | return res; |
| 438 | } |
Arjan van de Ven | 00977a5 | 2007-02-12 00:55:34 -0800 | [diff] [blame] | 439 | static const struct file_operations proc_stat_operations = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 440 | .open = stat_open, |
| 441 | .read = seq_read, |
| 442 | .llseek = seq_lseek, |
| 443 | .release = single_release, |
| 444 | }; |
| 445 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | /* |
| 447 | * /proc/interrupts |
| 448 | */ |
| 449 | static void *int_seq_start(struct seq_file *f, loff_t *pos) |
| 450 | { |
Yinghai Lu | da27c11 | 2008-08-19 20:49:56 -0700 | [diff] [blame] | 451 | return (*pos <= nr_irqs) ? pos : NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | } |
| 453 | |
Yinghai Lu | 52b1732 | 2008-08-19 20:50:20 -0700 | [diff] [blame] | 454 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos) |
| 456 | { |
| 457 | (*pos)++; |
Yinghai Lu | 52b1732 | 2008-08-19 20:50:20 -0700 | [diff] [blame] | 458 | return (*pos <= nr_irqs) ? pos : NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | } |
| 460 | |
| 461 | static void int_seq_stop(struct seq_file *f, void *v) |
| 462 | { |
| 463 | /* Nothing to do */ |
| 464 | } |
| 465 | |
Jan Engelhardt | 03a4482 | 2008-02-08 04:21:19 -0800 | [diff] [blame] | 466 | static const struct seq_operations int_seq_ops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | .start = int_seq_start, |
| 468 | .next = int_seq_next, |
| 469 | .stop = int_seq_stop, |
| 470 | .show = show_interrupts |
| 471 | }; |
| 472 | |
| 473 | static int interrupts_open(struct inode *inode, struct file *filp) |
| 474 | { |
| 475 | return seq_open(filp, &int_seq_ops); |
| 476 | } |
| 477 | |
Arjan van de Ven | 00977a5 | 2007-02-12 00:55:34 -0800 | [diff] [blame] | 478 | static const struct file_operations proc_interrupts_operations = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | .open = interrupts_open, |
| 480 | .read = seq_read, |
| 481 | .llseek = seq_lseek, |
| 482 | .release = seq_release, |
| 483 | }; |
| 484 | |
| 485 | static int filesystems_read_proc(char *page, char **start, off_t off, |
| 486 | int count, int *eof, void *data) |
| 487 | { |
| 488 | int len = get_filesystem_list(page); |
| 489 | return proc_calc_metrics(page, start, off, count, eof, len); |
| 490 | } |
| 491 | |
| 492 | static int cmdline_read_proc(char *page, char **start, off_t off, |
| 493 | int count, int *eof, void *data) |
| 494 | { |
| 495 | int len; |
| 496 | |
| 497 | len = sprintf(page, "%s\n", saved_command_line); |
| 498 | return proc_calc_metrics(page, start, off, count, eof, len); |
| 499 | } |
| 500 | |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 501 | #ifdef CONFIG_FILE_LOCKING |
Pavel Emelyanov | 7f8ada9 | 2007-10-01 14:41:15 -0700 | [diff] [blame] | 502 | static int locks_open(struct inode *inode, struct file *filp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | { |
Pavel Emelyanov | 7f8ada9 | 2007-10-01 14:41:15 -0700 | [diff] [blame] | 504 | return seq_open(filp, &locks_seq_operations); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | } |
| 506 | |
Pavel Emelyanov | 7f8ada9 | 2007-10-01 14:41:15 -0700 | [diff] [blame] | 507 | static const struct file_operations proc_locks_operations = { |
| 508 | .open = locks_open, |
| 509 | .read = seq_read, |
| 510 | .llseek = seq_lseek, |
| 511 | .release = seq_release, |
| 512 | }; |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 513 | #endif /* CONFIG_FILE_LOCKING */ |
Pavel Emelyanov | 7f8ada9 | 2007-10-01 14:41:15 -0700 | [diff] [blame] | 514 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 515 | static int execdomains_read_proc(char *page, char **start, off_t off, |
| 516 | int count, int *eof, void *data) |
| 517 | { |
| 518 | int len = get_exec_domain_list(page); |
| 519 | return proc_calc_metrics(page, start, off, count, eof, len); |
| 520 | } |
| 521 | |
Matt Mackall | 1e88328 | 2008-02-04 22:29:07 -0800 | [diff] [blame] | 522 | #ifdef CONFIG_PROC_PAGE_MONITOR |
Matt Mackall | 161f47b | 2008-02-04 22:29:05 -0800 | [diff] [blame] | 523 | #define KPMSIZE sizeof(u64) |
| 524 | #define KPMMASK (KPMSIZE - 1) |
| 525 | /* /proc/kpagecount - an array exposing page counts |
| 526 | * |
| 527 | * Each entry is a u64 representing the corresponding |
| 528 | * physical page count. |
| 529 | */ |
| 530 | static ssize_t kpagecount_read(struct file *file, char __user *buf, |
| 531 | size_t count, loff_t *ppos) |
| 532 | { |
| 533 | u64 __user *out = (u64 __user *)buf; |
| 534 | struct page *ppage; |
| 535 | unsigned long src = *ppos; |
| 536 | unsigned long pfn; |
| 537 | ssize_t ret = 0; |
| 538 | u64 pcount; |
| 539 | |
| 540 | pfn = src / KPMSIZE; |
| 541 | count = min_t(size_t, count, (max_pfn * KPMSIZE) - src); |
| 542 | if (src & KPMMASK || count & KPMMASK) |
Thomas Tuttle | 4710d1a | 2008-06-05 22:46:58 -0700 | [diff] [blame] | 543 | return -EINVAL; |
Matt Mackall | 161f47b | 2008-02-04 22:29:05 -0800 | [diff] [blame] | 544 | |
| 545 | while (count > 0) { |
Matt Mackall | 304daa8 | 2008-02-04 22:29:06 -0800 | [diff] [blame] | 546 | ppage = NULL; |
| 547 | if (pfn_valid(pfn)) |
| 548 | ppage = pfn_to_page(pfn); |
| 549 | pfn++; |
Matt Mackall | 161f47b | 2008-02-04 22:29:05 -0800 | [diff] [blame] | 550 | if (!ppage) |
| 551 | pcount = 0; |
| 552 | else |
Thomas Tuttle | bbcdac0 | 2008-06-05 22:46:58 -0700 | [diff] [blame] | 553 | pcount = page_mapcount(ppage); |
Matt Mackall | 161f47b | 2008-02-04 22:29:05 -0800 | [diff] [blame] | 554 | |
| 555 | if (put_user(pcount, out++)) { |
| 556 | ret = -EFAULT; |
| 557 | break; |
| 558 | } |
| 559 | |
| 560 | count -= KPMSIZE; |
| 561 | } |
| 562 | |
| 563 | *ppos += (char __user *)out - buf; |
| 564 | if (!ret) |
| 565 | ret = (char __user *)out - buf; |
| 566 | return ret; |
| 567 | } |
| 568 | |
| 569 | static struct file_operations proc_kpagecount_operations = { |
| 570 | .llseek = mem_lseek, |
| 571 | .read = kpagecount_read, |
| 572 | }; |
| 573 | |
Matt Mackall | 304daa8 | 2008-02-04 22:29:06 -0800 | [diff] [blame] | 574 | /* /proc/kpageflags - an array exposing page flags |
| 575 | * |
| 576 | * Each entry is a u64 representing the corresponding |
| 577 | * physical page flags. |
| 578 | */ |
| 579 | |
| 580 | /* These macros are used to decouple internal flags from exported ones */ |
| 581 | |
| 582 | #define KPF_LOCKED 0 |
| 583 | #define KPF_ERROR 1 |
| 584 | #define KPF_REFERENCED 2 |
| 585 | #define KPF_UPTODATE 3 |
| 586 | #define KPF_DIRTY 4 |
| 587 | #define KPF_LRU 5 |
| 588 | #define KPF_ACTIVE 6 |
| 589 | #define KPF_SLAB 7 |
| 590 | #define KPF_WRITEBACK 8 |
| 591 | #define KPF_RECLAIM 9 |
| 592 | #define KPF_BUDDY 10 |
| 593 | |
| 594 | #define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos) |
| 595 | |
| 596 | static ssize_t kpageflags_read(struct file *file, char __user *buf, |
| 597 | size_t count, loff_t *ppos) |
| 598 | { |
| 599 | u64 __user *out = (u64 __user *)buf; |
| 600 | struct page *ppage; |
| 601 | unsigned long src = *ppos; |
| 602 | unsigned long pfn; |
| 603 | ssize_t ret = 0; |
| 604 | u64 kflags, uflags; |
| 605 | |
| 606 | pfn = src / KPMSIZE; |
| 607 | count = min_t(unsigned long, count, (max_pfn * KPMSIZE) - src); |
| 608 | if (src & KPMMASK || count & KPMMASK) |
Thomas Tuttle | 4710d1a | 2008-06-05 22:46:58 -0700 | [diff] [blame] | 609 | return -EINVAL; |
Matt Mackall | 304daa8 | 2008-02-04 22:29:06 -0800 | [diff] [blame] | 610 | |
| 611 | while (count > 0) { |
| 612 | ppage = NULL; |
| 613 | if (pfn_valid(pfn)) |
| 614 | ppage = pfn_to_page(pfn); |
| 615 | pfn++; |
| 616 | if (!ppage) |
| 617 | kflags = 0; |
| 618 | else |
| 619 | kflags = ppage->flags; |
| 620 | |
| 621 | uflags = kpf_copy_bit(KPF_LOCKED, PG_locked, kflags) | |
| 622 | kpf_copy_bit(kflags, KPF_ERROR, PG_error) | |
| 623 | kpf_copy_bit(kflags, KPF_REFERENCED, PG_referenced) | |
| 624 | kpf_copy_bit(kflags, KPF_UPTODATE, PG_uptodate) | |
| 625 | kpf_copy_bit(kflags, KPF_DIRTY, PG_dirty) | |
| 626 | kpf_copy_bit(kflags, KPF_LRU, PG_lru) | |
| 627 | kpf_copy_bit(kflags, KPF_ACTIVE, PG_active) | |
| 628 | kpf_copy_bit(kflags, KPF_SLAB, PG_slab) | |
| 629 | kpf_copy_bit(kflags, KPF_WRITEBACK, PG_writeback) | |
| 630 | kpf_copy_bit(kflags, KPF_RECLAIM, PG_reclaim) | |
| 631 | kpf_copy_bit(kflags, KPF_BUDDY, PG_buddy); |
| 632 | |
| 633 | if (put_user(uflags, out++)) { |
| 634 | ret = -EFAULT; |
| 635 | break; |
| 636 | } |
| 637 | |
| 638 | count -= KPMSIZE; |
| 639 | } |
| 640 | |
| 641 | *ppos += (char __user *)out - buf; |
| 642 | if (!ret) |
| 643 | ret = (char __user *)out - buf; |
| 644 | return ret; |
| 645 | } |
| 646 | |
| 647 | static struct file_operations proc_kpageflags_operations = { |
| 648 | .llseek = mem_lseek, |
| 649 | .read = kpageflags_read, |
| 650 | }; |
Matt Mackall | 1e88328 | 2008-02-04 22:29:07 -0800 | [diff] [blame] | 651 | #endif /* CONFIG_PROC_PAGE_MONITOR */ |
Matt Mackall | 304daa8 | 2008-02-04 22:29:06 -0800 | [diff] [blame] | 652 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 653 | struct proc_dir_entry *proc_root_kcore; |
| 654 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 655 | void __init proc_misc_init(void) |
| 656 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 657 | static struct { |
| 658 | char *name; |
| 659 | int (*read_proc)(char*,char**,off_t,int,int*,void*); |
| 660 | } *p, simple_ones[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 661 | #ifdef CONFIG_STRAM_PROC |
| 662 | {"stram", stram_read_proc}, |
| 663 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 664 | {"filesystems", filesystems_read_proc}, |
| 665 | {"cmdline", cmdline_read_proc}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 666 | {"execdomains", execdomains_read_proc}, |
| 667 | {NULL,} |
| 668 | }; |
| 669 | for (p = simple_ones; p->name; p++) |
| 670 | create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL); |
| 671 | |
| 672 | proc_symlink("mounts", NULL, "self/mounts"); |
| 673 | |
| 674 | /* And now for trickier ones */ |
Mike Galbraith | c36264d | 2006-12-06 20:37:42 -0800 | [diff] [blame] | 675 | #ifdef CONFIG_PRINTK |
Alexey Dobriyan | c74c120 | 2008-04-29 01:01:44 -0700 | [diff] [blame] | 676 | proc_create("kmsg", S_IRUSR, NULL, &proc_kmsg_operations); |
Mike Galbraith | c36264d | 2006-12-06 20:37:42 -0800 | [diff] [blame] | 677 | #endif |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 678 | #ifdef CONFIG_FILE_LOCKING |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 679 | proc_create("locks", 0, NULL, &proc_locks_operations); |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 680 | #endif |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 681 | proc_create("devices", 0, NULL, &proc_devinfo_operations); |
| 682 | proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations); |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 683 | #ifdef CONFIG_BLOCK |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 684 | proc_create("partitions", 0, NULL, &proc_partitions_operations); |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 685 | #endif |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 686 | proc_create("stat", 0, NULL, &proc_stat_operations); |
| 687 | proc_create("interrupts", 0, NULL, &proc_interrupts_operations); |
Linus Torvalds | 158a962 | 2008-01-02 13:04:48 -0800 | [diff] [blame] | 688 | #ifdef CONFIG_SLABINFO |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 689 | proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations); |
Al Viro | 871751e | 2006-03-25 03:06:39 -0800 | [diff] [blame] | 690 | #ifdef CONFIG_DEBUG_SLAB_LEAK |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 691 | proc_create("slab_allocators", 0, NULL, &proc_slabstats_operations); |
Al Viro | 871751e | 2006-03-25 03:06:39 -0800 | [diff] [blame] | 692 | #endif |
Matt Mackall | 10cef60 | 2006-01-08 01:01:45 -0800 | [diff] [blame] | 693 | #endif |
Christoph Lameter | a10aa57 | 2008-04-28 02:12:40 -0700 | [diff] [blame] | 694 | #ifdef CONFIG_MMU |
| 695 | proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); |
| 696 | #endif |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 697 | proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); |
| 698 | proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); |
| 699 | proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); |
| 700 | proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 701 | #ifdef CONFIG_BLOCK |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 702 | proc_create("diskstats", 0, NULL, &proc_diskstats_operations); |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 703 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 704 | #ifdef CONFIG_MODULES |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 705 | proc_create("modules", 0, NULL, &proc_modules_operations); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 706 | #endif |
| 707 | #ifdef CONFIG_SCHEDSTATS |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 708 | proc_create("schedstat", 0, NULL, &proc_schedstat_operations); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 709 | #endif |
| 710 | #ifdef CONFIG_PROC_KCORE |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 711 | proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations); |
| 712 | if (proc_root_kcore) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 713 | proc_root_kcore->size = |
| 714 | (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 715 | #endif |
Matt Mackall | 1e88328 | 2008-02-04 22:29:07 -0800 | [diff] [blame] | 716 | #ifdef CONFIG_PROC_PAGE_MONITOR |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 717 | proc_create("kpagecount", S_IRUSR, NULL, &proc_kpagecount_operations); |
| 718 | proc_create("kpageflags", S_IRUSR, NULL, &proc_kpageflags_operations); |
Matt Mackall | 1e88328 | 2008-02-04 22:29:07 -0800 | [diff] [blame] | 719 | #endif |
Vivek Goyal | 666bfdd | 2005-06-25 14:58:21 -0700 | [diff] [blame] | 720 | #ifdef CONFIG_PROC_VMCORE |
Alexey Dobriyan | 0d5c9f5 | 2008-04-29 01:01:37 -0700 | [diff] [blame] | 721 | proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations); |
Vivek Goyal | 666bfdd | 2005-06-25 14:58:21 -0700 | [diff] [blame] | 722 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 723 | } |