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