]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - fs/proc/proc_misc.c
proc: switch /proc/meminfo to seq_file
[linux-2.6-omap-h63xx.git] / fs / proc / proc_misc.c
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>
23 #include <linux/fs.h>
24 #include <linux/tty.h>
25 #include <linux/string.h>
26 #include <linux/mman.h>
27 #include <linux/quicklist.h>
28 #include <linux/proc_fs.h>
29 #include <linux/ioport.h>
30 #include <linux/mm.h>
31 #include <linux/mmzone.h>
32 #include <linux/pagemap.h>
33 #include <linux/irq.h>
34 #include <linux/interrupt.h>
35 #include <linux/swap.h>
36 #include <linux/slab.h>
37 #include <linux/genhd.h>
38 #include <linux/smp.h>
39 #include <linux/signal.h>
40 #include <linux/module.h>
41 #include <linux/init.h>
42 #include <linux/seq_file.h>
43 #include <linux/times.h>
44 #include <linux/profile.h>
45 #include <linux/utsname.h>
46 #include <linux/blkdev.h>
47 #include <linux/hugetlb.h>
48 #include <linux/jiffies.h>
49 #include <linux/vmalloc.h>
50 #include <linux/crash_dump.h>
51 #include <linux/pid_namespace.h>
52 #include <linux/bootmem.h>
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
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  */
66 extern int get_hardware_list(char *);
67 extern int get_stram_list(char *);
68 extern int get_exec_domain_list(char *);
69
70 static int proc_calc_metrics(char *page, char **start, off_t off,
71                                  int count, int *eof, int len)
72 {
73         if (len <= off+count) *eof = 1;
74         *start = page + off;
75         len -= off;
76         if (len>count) len = count;
77         if (len<0) len = 0;
78         return len;
79 }
80
81 static int fragmentation_open(struct inode *inode, struct file *file)
82 {
83         (void)inode;
84         return seq_open(file, &fragmentation_op);
85 }
86
87 static const struct file_operations fragmentation_file_operations = {
88         .open           = fragmentation_open,
89         .read           = seq_read,
90         .llseek         = seq_lseek,
91         .release        = seq_release,
92 };
93
94 static int pagetypeinfo_open(struct inode *inode, struct file *file)
95 {
96         return seq_open(file, &pagetypeinfo_op);
97 }
98
99 static const struct file_operations pagetypeinfo_file_ops = {
100         .open           = pagetypeinfo_open,
101         .read           = seq_read,
102         .llseek         = seq_lseek,
103         .release        = seq_release,
104 };
105
106 static int zoneinfo_open(struct inode *inode, struct file *file)
107 {
108         return seq_open(file, &zoneinfo_op);
109 }
110
111 static const struct file_operations proc_zoneinfo_file_operations = {
112         .open           = zoneinfo_open,
113         .read           = seq_read,
114         .llseek         = seq_lseek,
115         .release        = seq_release,
116 };
117
118 static int version_read_proc(char *page, char **start, off_t off,
119                                  int count, int *eof, void *data)
120 {
121         int len;
122
123         len = snprintf(page, PAGE_SIZE, linux_proc_banner,
124                 utsname()->sysname,
125                 utsname()->release,
126                 utsname()->version);
127         return proc_calc_metrics(page, start, off, count, eof, len);
128 }
129
130 extern const struct seq_operations cpuinfo_op;
131 static int cpuinfo_open(struct inode *inode, struct file *file)
132 {
133         return seq_open(file, &cpuinfo_op);
134 }
135
136 static const struct file_operations proc_cpuinfo_operations = {
137         .open           = cpuinfo_open,
138         .read           = seq_read,
139         .llseek         = seq_lseek,
140         .release        = seq_release,
141 };
142
143 static int devinfo_show(struct seq_file *f, void *v)
144 {
145         int i = *(loff_t *) v;
146
147         if (i < CHRDEV_MAJOR_HASH_SIZE) {
148                 if (i == 0)
149                         seq_printf(f, "Character devices:\n");
150                 chrdev_show(f, i);
151         }
152 #ifdef CONFIG_BLOCK
153         else {
154                 i -= CHRDEV_MAJOR_HASH_SIZE;
155                 if (i == 0)
156                         seq_printf(f, "\nBlock devices:\n");
157                 blkdev_show(f, i);
158         }
159 #endif
160         return 0;
161 }
162
163 static void *devinfo_start(struct seq_file *f, loff_t *pos)
164 {
165         if (*pos < (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE))
166                 return pos;
167         return NULL;
168 }
169
170 static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos)
171 {
172         (*pos)++;
173         if (*pos >= (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE))
174                 return NULL;
175         return pos;
176 }
177
178 static void devinfo_stop(struct seq_file *f, void *v)
179 {
180         /* Nothing to do */
181 }
182
183 static const struct seq_operations devinfo_ops = {
184         .start = devinfo_start,
185         .next  = devinfo_next,
186         .stop  = devinfo_stop,
187         .show  = devinfo_show
188 };
189
190 static int devinfo_open(struct inode *inode, struct file *filp)
191 {
192         return seq_open(filp, &devinfo_ops);
193 }
194
195 static const struct file_operations proc_devinfo_operations = {
196         .open           = devinfo_open,
197         .read           = seq_read,
198         .llseek         = seq_lseek,
199         .release        = seq_release,
200 };
201
202 static int vmstat_open(struct inode *inode, struct file *file)
203 {
204         return seq_open(file, &vmstat_op);
205 }
206 static const struct file_operations proc_vmstat_file_operations = {
207         .open           = vmstat_open,
208         .read           = seq_read,
209         .llseek         = seq_lseek,
210         .release        = seq_release,
211 };
212
213 #ifdef CONFIG_PROC_HARDWARE
214 static int hardware_read_proc(char *page, char **start, off_t off,
215                                  int count, int *eof, void *data)
216 {
217         int len = get_hardware_list(page);
218         return proc_calc_metrics(page, start, off, count, eof, len);
219 }
220 #endif
221
222 #ifdef CONFIG_STRAM_PROC
223 static int stram_read_proc(char *page, char **start, off_t off,
224                                  int count, int *eof, void *data)
225 {
226         int len = get_stram_list(page);
227         return proc_calc_metrics(page, start, off, count, eof, len);
228 }
229 #endif
230
231 #ifdef CONFIG_BLOCK
232 static int partitions_open(struct inode *inode, struct file *file)
233 {
234         return seq_open(file, &partitions_op);
235 }
236 static const struct file_operations proc_partitions_operations = {
237         .open           = partitions_open,
238         .read           = seq_read,
239         .llseek         = seq_lseek,
240         .release        = seq_release,
241 };
242
243 static int diskstats_open(struct inode *inode, struct file *file)
244 {
245         return seq_open(file, &diskstats_op);
246 }
247 static const struct file_operations proc_diskstats_operations = {
248         .open           = diskstats_open,
249         .read           = seq_read,
250         .llseek         = seq_lseek,
251         .release        = seq_release,
252 };
253 #endif
254
255 #ifdef CONFIG_MODULES
256 extern const struct seq_operations modules_op;
257 static int modules_open(struct inode *inode, struct file *file)
258 {
259         return seq_open(file, &modules_op);
260 }
261 static const struct file_operations proc_modules_operations = {
262         .open           = modules_open,
263         .read           = seq_read,
264         .llseek         = seq_lseek,
265         .release        = seq_release,
266 };
267 #endif
268
269 #ifdef CONFIG_SLABINFO
270 static int slabinfo_open(struct inode *inode, struct file *file)
271 {
272         return seq_open(file, &slabinfo_op);
273 }
274 static const struct file_operations proc_slabinfo_operations = {
275         .open           = slabinfo_open,
276         .read           = seq_read,
277         .write          = slabinfo_write,
278         .llseek         = seq_lseek,
279         .release        = seq_release,
280 };
281
282 #ifdef CONFIG_DEBUG_SLAB_LEAK
283 extern const struct seq_operations slabstats_op;
284 static int slabstats_open(struct inode *inode, struct file *file)
285 {
286         unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL);
287         int ret = -ENOMEM;
288         if (n) {
289                 ret = seq_open(file, &slabstats_op);
290                 if (!ret) {
291                         struct seq_file *m = file->private_data;
292                         *n = PAGE_SIZE / (2 * sizeof(unsigned long));
293                         m->private = n;
294                         n = NULL;
295                 }
296                 kfree(n);
297         }
298         return ret;
299 }
300
301 static const struct file_operations proc_slabstats_operations = {
302         .open           = slabstats_open,
303         .read           = seq_read,
304         .llseek         = seq_lseek,
305         .release        = seq_release_private,
306 };
307 #endif
308 #endif
309
310 #ifdef CONFIG_MMU
311 static int vmalloc_open(struct inode *inode, struct file *file)
312 {
313         unsigned int *ptr = NULL;
314         int ret;
315
316         if (NUMA_BUILD)
317                 ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL);
318         ret = seq_open(file, &vmalloc_op);
319         if (!ret) {
320                 struct seq_file *m = file->private_data;
321                 m->private = ptr;
322         } else
323                 kfree(ptr);
324         return ret;
325 }
326
327 static const struct file_operations proc_vmalloc_operations = {
328         .open           = vmalloc_open,
329         .read           = seq_read,
330         .llseek         = seq_lseek,
331         .release        = seq_release_private,
332 };
333 #endif
334
335 #ifndef arch_irq_stat_cpu
336 #define arch_irq_stat_cpu(cpu) 0
337 #endif
338 #ifndef arch_irq_stat
339 #define arch_irq_stat() 0
340 #endif
341
342 static int show_stat(struct seq_file *p, void *v)
343 {
344         int i, j;
345         unsigned long jif;
346         cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
347         cputime64_t guest;
348         u64 sum = 0;
349         struct timespec boottime;
350         unsigned int per_irq_sum;
351
352         user = nice = system = idle = iowait =
353                 irq = softirq = steal = cputime64_zero;
354         guest = cputime64_zero;
355         getboottime(&boottime);
356         jif = boottime.tv_sec;
357
358         for_each_possible_cpu(i) {
359                 user = cputime64_add(user, kstat_cpu(i).cpustat.user);
360                 nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice);
361                 system = cputime64_add(system, kstat_cpu(i).cpustat.system);
362                 idle = cputime64_add(idle, kstat_cpu(i).cpustat.idle);
363                 iowait = cputime64_add(iowait, kstat_cpu(i).cpustat.iowait);
364                 irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq);
365                 softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
366                 steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
367                 guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
368
369                 for_each_irq_nr(j)
370                         sum += kstat_irqs_cpu(j, i);
371
372                 sum += arch_irq_stat_cpu(i);
373         }
374         sum += arch_irq_stat();
375
376         seq_printf(p, "cpu  %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
377                 (unsigned long long)cputime64_to_clock_t(user),
378                 (unsigned long long)cputime64_to_clock_t(nice),
379                 (unsigned long long)cputime64_to_clock_t(system),
380                 (unsigned long long)cputime64_to_clock_t(idle),
381                 (unsigned long long)cputime64_to_clock_t(iowait),
382                 (unsigned long long)cputime64_to_clock_t(irq),
383                 (unsigned long long)cputime64_to_clock_t(softirq),
384                 (unsigned long long)cputime64_to_clock_t(steal),
385                 (unsigned long long)cputime64_to_clock_t(guest));
386         for_each_online_cpu(i) {
387
388                 /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
389                 user = kstat_cpu(i).cpustat.user;
390                 nice = kstat_cpu(i).cpustat.nice;
391                 system = kstat_cpu(i).cpustat.system;
392                 idle = kstat_cpu(i).cpustat.idle;
393                 iowait = kstat_cpu(i).cpustat.iowait;
394                 irq = kstat_cpu(i).cpustat.irq;
395                 softirq = kstat_cpu(i).cpustat.softirq;
396                 steal = kstat_cpu(i).cpustat.steal;
397                 guest = kstat_cpu(i).cpustat.guest;
398                 seq_printf(p,
399                         "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
400                         i,
401                         (unsigned long long)cputime64_to_clock_t(user),
402                         (unsigned long long)cputime64_to_clock_t(nice),
403                         (unsigned long long)cputime64_to_clock_t(system),
404                         (unsigned long long)cputime64_to_clock_t(idle),
405                         (unsigned long long)cputime64_to_clock_t(iowait),
406                         (unsigned long long)cputime64_to_clock_t(irq),
407                         (unsigned long long)cputime64_to_clock_t(softirq),
408                         (unsigned long long)cputime64_to_clock_t(steal),
409                         (unsigned long long)cputime64_to_clock_t(guest));
410         }
411         seq_printf(p, "intr %llu", (unsigned long long)sum);
412
413         /* sum again ? it could be updated? */
414         for_each_irq_nr(j) {
415                 per_irq_sum = 0;
416
417                 for_each_possible_cpu(i)
418                         per_irq_sum += kstat_irqs_cpu(j, i);
419
420                 seq_printf(p, " %u", per_irq_sum);
421         }
422
423         seq_printf(p,
424                 "\nctxt %llu\n"
425                 "btime %lu\n"
426                 "processes %lu\n"
427                 "procs_running %lu\n"
428                 "procs_blocked %lu\n",
429                 nr_context_switches(),
430                 (unsigned long)jif,
431                 total_forks,
432                 nr_running(),
433                 nr_iowait());
434
435         return 0;
436 }
437
438 static int stat_open(struct inode *inode, struct file *file)
439 {
440         unsigned size = 4096 * (1 + num_possible_cpus() / 32);
441         char *buf;
442         struct seq_file *m;
443         int res;
444
445         /* don't ask for more than the kmalloc() max size, currently 128 KB */
446         if (size > 128 * 1024)
447                 size = 128 * 1024;
448         buf = kmalloc(size, GFP_KERNEL);
449         if (!buf)
450                 return -ENOMEM;
451
452         res = single_open(file, show_stat, NULL);
453         if (!res) {
454                 m = file->private_data;
455                 m->buf = buf;
456                 m->size = size;
457         } else
458                 kfree(buf);
459         return res;
460 }
461 static const struct file_operations proc_stat_operations = {
462         .open           = stat_open,
463         .read           = seq_read,
464         .llseek         = seq_lseek,
465         .release        = single_release,
466 };
467
468 /*
469  * /proc/interrupts
470  */
471 static void *int_seq_start(struct seq_file *f, loff_t *pos)
472 {
473         return (*pos <= nr_irqs) ? pos : NULL;
474 }
475
476
477 static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
478 {
479         (*pos)++;
480         return (*pos <= nr_irqs) ? pos : NULL;
481 }
482
483 static void int_seq_stop(struct seq_file *f, void *v)
484 {
485         /* Nothing to do */
486 }
487
488 static const struct seq_operations int_seq_ops = {
489         .start = int_seq_start,
490         .next  = int_seq_next,
491         .stop  = int_seq_stop,
492         .show  = show_interrupts
493 };
494
495 static int interrupts_open(struct inode *inode, struct file *filp)
496 {
497         return seq_open(filp, &int_seq_ops);
498 }
499
500 static const struct file_operations proc_interrupts_operations = {
501         .open           = interrupts_open,
502         .read           = seq_read,
503         .llseek         = seq_lseek,
504         .release        = seq_release,
505 };
506
507 static int filesystems_read_proc(char *page, char **start, off_t off,
508                                  int count, int *eof, void *data)
509 {
510         int len = get_filesystem_list(page);
511         return proc_calc_metrics(page, start, off, count, eof, len);
512 }
513
514 static int cmdline_read_proc(char *page, char **start, off_t off,
515                                  int count, int *eof, void *data)
516 {
517         int len;
518
519         len = sprintf(page, "%s\n", saved_command_line);
520         return proc_calc_metrics(page, start, off, count, eof, len);
521 }
522
523 #ifdef CONFIG_FILE_LOCKING
524 static int locks_open(struct inode *inode, struct file *filp)
525 {
526         return seq_open(filp, &locks_seq_operations);
527 }
528
529 static const struct file_operations proc_locks_operations = {
530         .open           = locks_open,
531         .read           = seq_read,
532         .llseek         = seq_lseek,
533         .release        = seq_release,
534 };
535 #endif /* CONFIG_FILE_LOCKING */
536
537 static int execdomains_read_proc(char *page, char **start, off_t off,
538                                  int count, int *eof, void *data)
539 {
540         int len = get_exec_domain_list(page);
541         return proc_calc_metrics(page, start, off, count, eof, len);
542 }
543
544 #ifdef CONFIG_PROC_PAGE_MONITOR
545 #define KPMSIZE sizeof(u64)
546 #define KPMMASK (KPMSIZE - 1)
547 /* /proc/kpagecount - an array exposing page counts
548  *
549  * Each entry is a u64 representing the corresponding
550  * physical page count.
551  */
552 static ssize_t kpagecount_read(struct file *file, char __user *buf,
553                              size_t count, loff_t *ppos)
554 {
555         u64 __user *out = (u64 __user *)buf;
556         struct page *ppage;
557         unsigned long src = *ppos;
558         unsigned long pfn;
559         ssize_t ret = 0;
560         u64 pcount;
561
562         pfn = src / KPMSIZE;
563         count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
564         if (src & KPMMASK || count & KPMMASK)
565                 return -EINVAL;
566
567         while (count > 0) {
568                 ppage = NULL;
569                 if (pfn_valid(pfn))
570                         ppage = pfn_to_page(pfn);
571                 pfn++;
572                 if (!ppage)
573                         pcount = 0;
574                 else
575                         pcount = page_mapcount(ppage);
576
577                 if (put_user(pcount, out++)) {
578                         ret = -EFAULT;
579                         break;
580                 }
581
582                 count -= KPMSIZE;
583         }
584
585         *ppos += (char __user *)out - buf;
586         if (!ret)
587                 ret = (char __user *)out - buf;
588         return ret;
589 }
590
591 static struct file_operations proc_kpagecount_operations = {
592         .llseek = mem_lseek,
593         .read = kpagecount_read,
594 };
595
596 /* /proc/kpageflags - an array exposing page flags
597  *
598  * Each entry is a u64 representing the corresponding
599  * physical page flags.
600  */
601
602 /* These macros are used to decouple internal flags from exported ones */
603
604 #define KPF_LOCKED     0
605 #define KPF_ERROR      1
606 #define KPF_REFERENCED 2
607 #define KPF_UPTODATE   3
608 #define KPF_DIRTY      4
609 #define KPF_LRU        5
610 #define KPF_ACTIVE     6
611 #define KPF_SLAB       7
612 #define KPF_WRITEBACK  8
613 #define KPF_RECLAIM    9
614 #define KPF_BUDDY     10
615
616 #define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
617
618 static ssize_t kpageflags_read(struct file *file, char __user *buf,
619                              size_t count, loff_t *ppos)
620 {
621         u64 __user *out = (u64 __user *)buf;
622         struct page *ppage;
623         unsigned long src = *ppos;
624         unsigned long pfn;
625         ssize_t ret = 0;
626         u64 kflags, uflags;
627
628         pfn = src / KPMSIZE;
629         count = min_t(unsigned long, count, (max_pfn * KPMSIZE) - src);
630         if (src & KPMMASK || count & KPMMASK)
631                 return -EINVAL;
632
633         while (count > 0) {
634                 ppage = NULL;
635                 if (pfn_valid(pfn))
636                         ppage = pfn_to_page(pfn);
637                 pfn++;
638                 if (!ppage)
639                         kflags = 0;
640                 else
641                         kflags = ppage->flags;
642
643                 uflags = kpf_copy_bit(KPF_LOCKED, PG_locked, kflags) |
644                         kpf_copy_bit(kflags, KPF_ERROR, PG_error) |
645                         kpf_copy_bit(kflags, KPF_REFERENCED, PG_referenced) |
646                         kpf_copy_bit(kflags, KPF_UPTODATE, PG_uptodate) |
647                         kpf_copy_bit(kflags, KPF_DIRTY, PG_dirty) |
648                         kpf_copy_bit(kflags, KPF_LRU, PG_lru) |
649                         kpf_copy_bit(kflags, KPF_ACTIVE, PG_active) |
650                         kpf_copy_bit(kflags, KPF_SLAB, PG_slab) |
651                         kpf_copy_bit(kflags, KPF_WRITEBACK, PG_writeback) |
652                         kpf_copy_bit(kflags, KPF_RECLAIM, PG_reclaim) |
653                         kpf_copy_bit(kflags, KPF_BUDDY, PG_buddy);
654
655                 if (put_user(uflags, out++)) {
656                         ret = -EFAULT;
657                         break;
658                 }
659
660                 count -= KPMSIZE;
661         }
662
663         *ppos += (char __user *)out - buf;
664         if (!ret)
665                 ret = (char __user *)out - buf;
666         return ret;
667 }
668
669 static struct file_operations proc_kpageflags_operations = {
670         .llseek = mem_lseek,
671         .read = kpageflags_read,
672 };
673 #endif /* CONFIG_PROC_PAGE_MONITOR */
674
675 struct proc_dir_entry *proc_root_kcore;
676
677 void __init proc_misc_init(void)
678 {
679         static struct {
680                 char *name;
681                 int (*read_proc)(char*,char**,off_t,int,int*,void*);
682         } *p, simple_ones[] = {
683                 {"version",     version_read_proc},
684 #ifdef CONFIG_PROC_HARDWARE
685                 {"hardware",    hardware_read_proc},
686 #endif
687 #ifdef CONFIG_STRAM_PROC
688                 {"stram",       stram_read_proc},
689 #endif
690                 {"filesystems", filesystems_read_proc},
691                 {"cmdline",     cmdline_read_proc},
692                 {"execdomains", execdomains_read_proc},
693                 {NULL,}
694         };
695         for (p = simple_ones; p->name; p++)
696                 create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);
697
698         proc_symlink("mounts", NULL, "self/mounts");
699
700         /* And now for trickier ones */
701 #ifdef CONFIG_PRINTK
702         proc_create("kmsg", S_IRUSR, NULL, &proc_kmsg_operations);
703 #endif
704 #ifdef CONFIG_FILE_LOCKING
705         proc_create("locks", 0, NULL, &proc_locks_operations);
706 #endif
707         proc_create("devices", 0, NULL, &proc_devinfo_operations);
708         proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations);
709 #ifdef CONFIG_BLOCK
710         proc_create("partitions", 0, NULL, &proc_partitions_operations);
711 #endif
712         proc_create("stat", 0, NULL, &proc_stat_operations);
713         proc_create("interrupts", 0, NULL, &proc_interrupts_operations);
714 #ifdef CONFIG_SLABINFO
715         proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations);
716 #ifdef CONFIG_DEBUG_SLAB_LEAK
717         proc_create("slab_allocators", 0, NULL, &proc_slabstats_operations);
718 #endif
719 #endif
720 #ifdef CONFIG_MMU
721         proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations);
722 #endif
723         proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations);
724         proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops);
725         proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations);
726         proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations);
727 #ifdef CONFIG_BLOCK
728         proc_create("diskstats", 0, NULL, &proc_diskstats_operations);
729 #endif
730 #ifdef CONFIG_MODULES
731         proc_create("modules", 0, NULL, &proc_modules_operations);
732 #endif
733 #ifdef CONFIG_SCHEDSTATS
734         proc_create("schedstat", 0, NULL, &proc_schedstat_operations);
735 #endif
736 #ifdef CONFIG_PROC_KCORE
737         proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations);
738         if (proc_root_kcore)
739                 proc_root_kcore->size =
740                                 (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
741 #endif
742 #ifdef CONFIG_PROC_PAGE_MONITOR
743         proc_create("kpagecount", S_IRUSR, NULL, &proc_kpagecount_operations);
744         proc_create("kpageflags", S_IRUSR, NULL, &proc_kpageflags_operations);
745 #endif
746 #ifdef CONFIG_PROC_VMCORE
747         proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations);
748 #endif
749 }