Remove obsolete #include <linux/config.h>
[pandora-kernel.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/proc_fs.h>
28 #include <linux/ioport.h>
29 #include <linux/mm.h>
30 #include <linux/mmzone.h>
31 #include <linux/pagemap.h>
32 #include <linux/swap.h>
33 #include <linux/slab.h>
34 #include <linux/smp.h>
35 #include <linux/signal.h>
36 #include <linux/module.h>
37 #include <linux/init.h>
38 #include <linux/smp_lock.h>
39 #include <linux/seq_file.h>
40 #include <linux/times.h>
41 #include <linux/profile.h>
42 #include <linux/blkdev.h>
43 #include <linux/hugetlb.h>
44 #include <linux/jiffies.h>
45 #include <linux/sysrq.h>
46 #include <linux/vmalloc.h>
47 #include <linux/crash_dump.h>
48 #include <asm/uaccess.h>
49 #include <asm/pgtable.h>
50 #include <asm/io.h>
51 #include <asm/tlb.h>
52 #include <asm/div64.h>
53 #include "internal.h"
54
55 #define LOAD_INT(x) ((x) >> FSHIFT)
56 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
57 /*
58  * Warning: stuff below (imported functions) assumes that its output will fit
59  * into one page. For some of those functions it may be wrong. Moreover, we
60  * have a way to deal with that gracefully. Right now I used straightforward
61  * wrappers, but this needs further analysis wrt potential overflows.
62  */
63 extern int get_hardware_list(char *);
64 extern int get_stram_list(char *);
65 extern int get_filesystem_list(char *);
66 extern int get_exec_domain_list(char *);
67 extern int get_dma_list(char *);
68 extern int get_locks_status (char *, char **, off_t, int);
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 loadavg_read_proc(char *page, char **start, off_t off,
82                                  int count, int *eof, void *data)
83 {
84         int a, b, c;
85         int len;
86
87         a = avenrun[0] + (FIXED_1/200);
88         b = avenrun[1] + (FIXED_1/200);
89         c = avenrun[2] + (FIXED_1/200);
90         len = sprintf(page,"%d.%02d %d.%02d %d.%02d %ld/%d %d\n",
91                 LOAD_INT(a), LOAD_FRAC(a),
92                 LOAD_INT(b), LOAD_FRAC(b),
93                 LOAD_INT(c), LOAD_FRAC(c),
94                 nr_running(), nr_threads, last_pid);
95         return proc_calc_metrics(page, start, off, count, eof, len);
96 }
97
98 static int uptime_read_proc(char *page, char **start, off_t off,
99                                  int count, int *eof, void *data)
100 {
101         struct timespec uptime;
102         struct timespec idle;
103         int len;
104         cputime_t idletime = cputime_add(init_task.utime, init_task.stime);
105
106         do_posix_clock_monotonic_gettime(&uptime);
107         cputime_to_timespec(idletime, &idle);
108         len = sprintf(page,"%lu.%02lu %lu.%02lu\n",
109                         (unsigned long) uptime.tv_sec,
110                         (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
111                         (unsigned long) idle.tv_sec,
112                         (idle.tv_nsec / (NSEC_PER_SEC / 100)));
113
114         return proc_calc_metrics(page, start, off, count, eof, len);
115 }
116
117 static int meminfo_read_proc(char *page, char **start, off_t off,
118                                  int count, int *eof, void *data)
119 {
120         struct sysinfo i;
121         int len;
122         struct page_state ps;
123         unsigned long inactive;
124         unsigned long active;
125         unsigned long free;
126         unsigned long committed;
127         unsigned long allowed;
128         struct vmalloc_info vmi;
129         long cached;
130
131         get_page_state(&ps);
132         get_zone_counts(&active, &inactive, &free);
133
134 /*
135  * display in kilobytes.
136  */
137 #define K(x) ((x) << (PAGE_SHIFT - 10))
138         si_meminfo(&i);
139         si_swapinfo(&i);
140         committed = atomic_read(&vm_committed_space);
141         allowed = ((totalram_pages - hugetlb_total_pages())
142                 * sysctl_overcommit_ratio / 100) + total_swap_pages;
143
144         cached = get_page_cache_size() - total_swapcache_pages - i.bufferram;
145         if (cached < 0)
146                 cached = 0;
147
148         get_vmalloc_info(&vmi);
149
150         /*
151          * Tagged format, for easy grepping and expansion.
152          */
153         len = sprintf(page,
154                 "MemTotal:     %8lu kB\n"
155                 "MemFree:      %8lu kB\n"
156                 "Buffers:      %8lu kB\n"
157                 "Cached:       %8lu kB\n"
158                 "SwapCached:   %8lu kB\n"
159                 "Active:       %8lu kB\n"
160                 "Inactive:     %8lu kB\n"
161                 "HighTotal:    %8lu kB\n"
162                 "HighFree:     %8lu kB\n"
163                 "LowTotal:     %8lu kB\n"
164                 "LowFree:      %8lu kB\n"
165                 "SwapTotal:    %8lu kB\n"
166                 "SwapFree:     %8lu kB\n"
167                 "Dirty:        %8lu kB\n"
168                 "Writeback:    %8lu kB\n"
169                 "Mapped:       %8lu kB\n"
170                 "Slab:         %8lu kB\n"
171                 "CommitLimit:  %8lu kB\n"
172                 "Committed_AS: %8lu kB\n"
173                 "PageTables:   %8lu kB\n"
174                 "VmallocTotal: %8lu kB\n"
175                 "VmallocUsed:  %8lu kB\n"
176                 "VmallocChunk: %8lu kB\n",
177                 K(i.totalram),
178                 K(i.freeram),
179                 K(i.bufferram),
180                 K(cached),
181                 K(total_swapcache_pages),
182                 K(active),
183                 K(inactive),
184                 K(i.totalhigh),
185                 K(i.freehigh),
186                 K(i.totalram-i.totalhigh),
187                 K(i.freeram-i.freehigh),
188                 K(i.totalswap),
189                 K(i.freeswap),
190                 K(ps.nr_dirty),
191                 K(ps.nr_writeback),
192                 K(ps.nr_mapped),
193                 K(ps.nr_slab),
194                 K(allowed),
195                 K(committed),
196                 K(ps.nr_page_table_pages),
197                 (unsigned long)VMALLOC_TOTAL >> 10,
198                 vmi.used >> 10,
199                 vmi.largest_chunk >> 10
200                 );
201
202                 len += hugetlb_report_meminfo(page + len);
203
204         return proc_calc_metrics(page, start, off, count, eof, len);
205 #undef K
206 }
207
208 extern struct seq_operations fragmentation_op;
209 static int fragmentation_open(struct inode *inode, struct file *file)
210 {
211         (void)inode;
212         return seq_open(file, &fragmentation_op);
213 }
214
215 static struct file_operations fragmentation_file_operations = {
216         .open           = fragmentation_open,
217         .read           = seq_read,
218         .llseek         = seq_lseek,
219         .release        = seq_release,
220 };
221
222 extern struct seq_operations zoneinfo_op;
223 static int zoneinfo_open(struct inode *inode, struct file *file)
224 {
225         return seq_open(file, &zoneinfo_op);
226 }
227
228 static struct file_operations proc_zoneinfo_file_operations = {
229         .open           = zoneinfo_open,
230         .read           = seq_read,
231         .llseek         = seq_lseek,
232         .release        = seq_release,
233 };
234
235 static int version_read_proc(char *page, char **start, off_t off,
236                                  int count, int *eof, void *data)
237 {
238         int len;
239
240         strcpy(page, linux_banner);
241         len = strlen(page);
242         return proc_calc_metrics(page, start, off, count, eof, len);
243 }
244
245 extern struct seq_operations cpuinfo_op;
246 static int cpuinfo_open(struct inode *inode, struct file *file)
247 {
248         return seq_open(file, &cpuinfo_op);
249 }
250
251 static struct file_operations proc_cpuinfo_operations = {
252         .open           = cpuinfo_open,
253         .read           = seq_read,
254         .llseek         = seq_lseek,
255         .release        = seq_release,
256 };
257
258 static int devinfo_show(struct seq_file *f, void *v)
259 {
260         int i = *(loff_t *) v;
261
262         if (i < CHRDEV_MAJOR_HASH_SIZE) {
263                 if (i == 0)
264                         seq_printf(f, "Character devices:\n");
265                 chrdev_show(f, i);
266         } else {
267                 i -= CHRDEV_MAJOR_HASH_SIZE;
268                 if (i == 0)
269                         seq_printf(f, "\nBlock devices:\n");
270                 blkdev_show(f, i);
271         }
272         return 0;
273 }
274
275 static void *devinfo_start(struct seq_file *f, loff_t *pos)
276 {
277         if (*pos < (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE))
278                 return pos;
279         return NULL;
280 }
281
282 static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos)
283 {
284         (*pos)++;
285         if (*pos >= (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE))
286                 return NULL;
287         return pos;
288 }
289
290 static void devinfo_stop(struct seq_file *f, void *v)
291 {
292         /* Nothing to do */
293 }
294
295 static struct seq_operations devinfo_ops = {
296         .start = devinfo_start,
297         .next  = devinfo_next,
298         .stop  = devinfo_stop,
299         .show  = devinfo_show
300 };
301
302 static int devinfo_open(struct inode *inode, struct file *filp)
303 {
304         return seq_open(filp, &devinfo_ops);
305 }
306
307 static struct file_operations proc_devinfo_operations = {
308         .open           = devinfo_open,
309         .read           = seq_read,
310         .llseek         = seq_lseek,
311         .release        = seq_release,
312 };
313
314 extern struct seq_operations vmstat_op;
315 static int vmstat_open(struct inode *inode, struct file *file)
316 {
317         return seq_open(file, &vmstat_op);
318 }
319 static struct file_operations proc_vmstat_file_operations = {
320         .open           = vmstat_open,
321         .read           = seq_read,
322         .llseek         = seq_lseek,
323         .release        = seq_release,
324 };
325
326 #ifdef CONFIG_PROC_HARDWARE
327 static int hardware_read_proc(char *page, char **start, off_t off,
328                                  int count, int *eof, void *data)
329 {
330         int len = get_hardware_list(page);
331         return proc_calc_metrics(page, start, off, count, eof, len);
332 }
333 #endif
334
335 #ifdef CONFIG_STRAM_PROC
336 static int stram_read_proc(char *page, char **start, off_t off,
337                                  int count, int *eof, void *data)
338 {
339         int len = get_stram_list(page);
340         return proc_calc_metrics(page, start, off, count, eof, len);
341 }
342 #endif
343
344 extern struct seq_operations partitions_op;
345 static int partitions_open(struct inode *inode, struct file *file)
346 {
347         return seq_open(file, &partitions_op);
348 }
349 static struct file_operations proc_partitions_operations = {
350         .open           = partitions_open,
351         .read           = seq_read,
352         .llseek         = seq_lseek,
353         .release        = seq_release,
354 };
355
356 extern struct seq_operations diskstats_op;
357 static int diskstats_open(struct inode *inode, struct file *file)
358 {
359         return seq_open(file, &diskstats_op);
360 }
361 static struct file_operations proc_diskstats_operations = {
362         .open           = diskstats_open,
363         .read           = seq_read,
364         .llseek         = seq_lseek,
365         .release        = seq_release,
366 };
367
368 #ifdef CONFIG_MODULES
369 extern struct seq_operations modules_op;
370 static int modules_open(struct inode *inode, struct file *file)
371 {
372         return seq_open(file, &modules_op);
373 }
374 static struct file_operations proc_modules_operations = {
375         .open           = modules_open,
376         .read           = seq_read,
377         .llseek         = seq_lseek,
378         .release        = seq_release,
379 };
380 #endif
381
382 #ifdef CONFIG_SLAB
383 extern struct seq_operations slabinfo_op;
384 extern ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
385 static int slabinfo_open(struct inode *inode, struct file *file)
386 {
387         return seq_open(file, &slabinfo_op);
388 }
389 static struct file_operations proc_slabinfo_operations = {
390         .open           = slabinfo_open,
391         .read           = seq_read,
392         .write          = slabinfo_write,
393         .llseek         = seq_lseek,
394         .release        = seq_release,
395 };
396
397 #ifdef CONFIG_DEBUG_SLAB_LEAK
398 extern struct seq_operations slabstats_op;
399 static int slabstats_open(struct inode *inode, struct file *file)
400 {
401         unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL);
402         int ret = -ENOMEM;
403         if (n) {
404                 ret = seq_open(file, &slabstats_op);
405                 if (!ret) {
406                         struct seq_file *m = file->private_data;
407                         *n = PAGE_SIZE / (2 * sizeof(unsigned long));
408                         m->private = n;
409                         n = NULL;
410                 }
411                 kfree(n);
412         }
413         return ret;
414 }
415
416 static int slabstats_release(struct inode *inode, struct file *file)
417 {
418         struct seq_file *m = file->private_data;
419         kfree(m->private);
420         return seq_release(inode, file);
421 }
422
423 static struct file_operations proc_slabstats_operations = {
424         .open           = slabstats_open,
425         .read           = seq_read,
426         .llseek         = seq_lseek,
427         .release        = slabstats_release,
428 };
429 #endif
430 #endif
431
432 static int show_stat(struct seq_file *p, void *v)
433 {
434         int i;
435         unsigned long jif;
436         cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
437         u64 sum = 0;
438
439         user = nice = system = idle = iowait =
440                 irq = softirq = steal = cputime64_zero;
441         jif = - wall_to_monotonic.tv_sec;
442         if (wall_to_monotonic.tv_nsec)
443                 --jif;
444
445         for_each_possible_cpu(i) {
446                 int j;
447
448                 user = cputime64_add(user, kstat_cpu(i).cpustat.user);
449                 nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice);
450                 system = cputime64_add(system, kstat_cpu(i).cpustat.system);
451                 idle = cputime64_add(idle, kstat_cpu(i).cpustat.idle);
452                 iowait = cputime64_add(iowait, kstat_cpu(i).cpustat.iowait);
453                 irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq);
454                 softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
455                 steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
456                 for (j = 0 ; j < NR_IRQS ; j++)
457                         sum += kstat_cpu(i).irqs[j];
458         }
459
460         seq_printf(p, "cpu  %llu %llu %llu %llu %llu %llu %llu %llu\n",
461                 (unsigned long long)cputime64_to_clock_t(user),
462                 (unsigned long long)cputime64_to_clock_t(nice),
463                 (unsigned long long)cputime64_to_clock_t(system),
464                 (unsigned long long)cputime64_to_clock_t(idle),
465                 (unsigned long long)cputime64_to_clock_t(iowait),
466                 (unsigned long long)cputime64_to_clock_t(irq),
467                 (unsigned long long)cputime64_to_clock_t(softirq),
468                 (unsigned long long)cputime64_to_clock_t(steal));
469         for_each_online_cpu(i) {
470
471                 /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
472                 user = kstat_cpu(i).cpustat.user;
473                 nice = kstat_cpu(i).cpustat.nice;
474                 system = kstat_cpu(i).cpustat.system;
475                 idle = kstat_cpu(i).cpustat.idle;
476                 iowait = kstat_cpu(i).cpustat.iowait;
477                 irq = kstat_cpu(i).cpustat.irq;
478                 softirq = kstat_cpu(i).cpustat.softirq;
479                 steal = kstat_cpu(i).cpustat.steal;
480                 seq_printf(p, "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu\n",
481                         i,
482                         (unsigned long long)cputime64_to_clock_t(user),
483                         (unsigned long long)cputime64_to_clock_t(nice),
484                         (unsigned long long)cputime64_to_clock_t(system),
485                         (unsigned long long)cputime64_to_clock_t(idle),
486                         (unsigned long long)cputime64_to_clock_t(iowait),
487                         (unsigned long long)cputime64_to_clock_t(irq),
488                         (unsigned long long)cputime64_to_clock_t(softirq),
489                         (unsigned long long)cputime64_to_clock_t(steal));
490         }
491         seq_printf(p, "intr %llu", (unsigned long long)sum);
492
493 #if !defined(CONFIG_PPC64) && !defined(CONFIG_ALPHA) && !defined(CONFIG_IA64)
494         for (i = 0; i < NR_IRQS; i++)
495                 seq_printf(p, " %u", kstat_irqs(i));
496 #endif
497
498         seq_printf(p,
499                 "\nctxt %llu\n"
500                 "btime %lu\n"
501                 "processes %lu\n"
502                 "procs_running %lu\n"
503                 "procs_blocked %lu\n",
504                 nr_context_switches(),
505                 (unsigned long)jif,
506                 total_forks,
507                 nr_running(),
508                 nr_iowait());
509
510         return 0;
511 }
512
513 static int stat_open(struct inode *inode, struct file *file)
514 {
515         unsigned size = 4096 * (1 + num_possible_cpus() / 32);
516         char *buf;
517         struct seq_file *m;
518         int res;
519
520         /* don't ask for more than the kmalloc() max size, currently 128 KB */
521         if (size > 128 * 1024)
522                 size = 128 * 1024;
523         buf = kmalloc(size, GFP_KERNEL);
524         if (!buf)
525                 return -ENOMEM;
526
527         res = single_open(file, show_stat, NULL);
528         if (!res) {
529                 m = file->private_data;
530                 m->buf = buf;
531                 m->size = size;
532         } else
533                 kfree(buf);
534         return res;
535 }
536 static struct file_operations proc_stat_operations = {
537         .open           = stat_open,
538         .read           = seq_read,
539         .llseek         = seq_lseek,
540         .release        = single_release,
541 };
542
543 /*
544  * /proc/interrupts
545  */
546 static void *int_seq_start(struct seq_file *f, loff_t *pos)
547 {
548         return (*pos <= NR_IRQS) ? pos : NULL;
549 }
550
551 static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
552 {
553         (*pos)++;
554         if (*pos > NR_IRQS)
555                 return NULL;
556         return pos;
557 }
558
559 static void int_seq_stop(struct seq_file *f, void *v)
560 {
561         /* Nothing to do */
562 }
563
564
565 extern int show_interrupts(struct seq_file *f, void *v); /* In arch code */
566 static struct seq_operations int_seq_ops = {
567         .start = int_seq_start,
568         .next  = int_seq_next,
569         .stop  = int_seq_stop,
570         .show  = show_interrupts
571 };
572
573 static int interrupts_open(struct inode *inode, struct file *filp)
574 {
575         return seq_open(filp, &int_seq_ops);
576 }
577
578 static struct file_operations proc_interrupts_operations = {
579         .open           = interrupts_open,
580         .read           = seq_read,
581         .llseek         = seq_lseek,
582         .release        = seq_release,
583 };
584
585 static int filesystems_read_proc(char *page, char **start, off_t off,
586                                  int count, int *eof, void *data)
587 {
588         int len = get_filesystem_list(page);
589         return proc_calc_metrics(page, start, off, count, eof, len);
590 }
591
592 static int cmdline_read_proc(char *page, char **start, off_t off,
593                                  int count, int *eof, void *data)
594 {
595         int len;
596
597         len = sprintf(page, "%s\n", saved_command_line);
598         return proc_calc_metrics(page, start, off, count, eof, len);
599 }
600
601 static int locks_read_proc(char *page, char **start, off_t off,
602                                  int count, int *eof, void *data)
603 {
604         int len = get_locks_status(page, start, off, count);
605
606         if (len < count)
607                 *eof = 1;
608         return len;
609 }
610
611 static int execdomains_read_proc(char *page, char **start, off_t off,
612                                  int count, int *eof, void *data)
613 {
614         int len = get_exec_domain_list(page);
615         return proc_calc_metrics(page, start, off, count, eof, len);
616 }
617
618 #ifdef CONFIG_MAGIC_SYSRQ
619 /*
620  * writing 'C' to /proc/sysrq-trigger is like sysrq-C
621  */
622 static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
623                                    size_t count, loff_t *ppos)
624 {
625         if (count) {
626                 char c;
627
628                 if (get_user(c, buf))
629                         return -EFAULT;
630                 __handle_sysrq(c, NULL, NULL, 0);
631         }
632         return count;
633 }
634
635 static struct file_operations proc_sysrq_trigger_operations = {
636         .write          = write_sysrq_trigger,
637 };
638 #endif
639
640 struct proc_dir_entry *proc_root_kcore;
641
642 void create_seq_entry(char *name, mode_t mode, const struct file_operations *f)
643 {
644         struct proc_dir_entry *entry;
645         entry = create_proc_entry(name, mode, NULL);
646         if (entry)
647                 entry->proc_fops = f;
648 }
649
650 void __init proc_misc_init(void)
651 {
652         struct proc_dir_entry *entry;
653         static struct {
654                 char *name;
655                 int (*read_proc)(char*,char**,off_t,int,int*,void*);
656         } *p, simple_ones[] = {
657                 {"loadavg",     loadavg_read_proc},
658                 {"uptime",      uptime_read_proc},
659                 {"meminfo",     meminfo_read_proc},
660                 {"version",     version_read_proc},
661 #ifdef CONFIG_PROC_HARDWARE
662                 {"hardware",    hardware_read_proc},
663 #endif
664 #ifdef CONFIG_STRAM_PROC
665                 {"stram",       stram_read_proc},
666 #endif
667                 {"filesystems", filesystems_read_proc},
668                 {"cmdline",     cmdline_read_proc},
669                 {"locks",       locks_read_proc},
670                 {"execdomains", execdomains_read_proc},
671                 {NULL,}
672         };
673         for (p = simple_ones; p->name; p++)
674                 create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);
675
676         proc_symlink("mounts", NULL, "self/mounts");
677
678         /* And now for trickier ones */
679         entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
680         if (entry)
681                 entry->proc_fops = &proc_kmsg_operations;
682         create_seq_entry("devices", 0, &proc_devinfo_operations);
683         create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
684         create_seq_entry("partitions", 0, &proc_partitions_operations);
685         create_seq_entry("stat", 0, &proc_stat_operations);
686         create_seq_entry("interrupts", 0, &proc_interrupts_operations);
687 #ifdef CONFIG_SLAB
688         create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
689 #ifdef CONFIG_DEBUG_SLAB_LEAK
690         create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations);
691 #endif
692 #endif
693         create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations);
694         create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations);
695         create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations);
696         create_seq_entry("diskstats", 0, &proc_diskstats_operations);
697 #ifdef CONFIG_MODULES
698         create_seq_entry("modules", 0, &proc_modules_operations);
699 #endif
700 #ifdef CONFIG_SCHEDSTATS
701         create_seq_entry("schedstat", 0, &proc_schedstat_operations);
702 #endif
703 #ifdef CONFIG_PROC_KCORE
704         proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL);
705         if (proc_root_kcore) {
706                 proc_root_kcore->proc_fops = &proc_kcore_operations;
707                 proc_root_kcore->size =
708                                 (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
709         }
710 #endif
711 #ifdef CONFIG_PROC_VMCORE
712         proc_vmcore = create_proc_entry("vmcore", S_IRUSR, NULL);
713         if (proc_vmcore)
714                 proc_vmcore->proc_fops = &proc_vmcore_operations;
715 #endif
716 #ifdef CONFIG_MAGIC_SYSRQ
717         entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL);
718         if (entry)
719                 entry->proc_fops = &proc_sysrq_trigger_operations;
720 #endif
721 }