RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / fs / proc / proc_misc.c
blob33d2d201f90a1efbc21389a2c3fc217ebd8824dd
1 /*
2 * linux/fs/proc/proc_misc.c
4 * linux/fs/proc/array.c
5 * Copyright (C) 1992 by Linus Torvalds
6 * based on ideas by Darren Senn
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.
13 * Changes:
14 * Fulton Green : Encapsulated position metric calculations.
15 * <kernel@FultonGreen.com>
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/seq_file.h>
39 #include <linux/times.h>
40 #include <linux/profile.h>
41 #include <linux/utsname.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 <linux/pid_namespace.h>
49 #include <asm/uaccess.h>
50 #include <asm/pgtable.h>
51 #include <asm/io.h>
52 #include <asm/tlb.h>
53 #include <asm/div64.h>
54 #include "internal.h"
56 #define LOAD_INT(x) ((x) >> FSHIFT)
57 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
59 * Warning: stuff below (imported functions) assumes that its output will fit
60 * into one page. For some of those functions it may be wrong. Moreover, we
61 * have a way to deal with that gracefully. Right now I used straightforward
62 * wrappers, but this needs further analysis wrt potential overflows.
64 extern int get_hardware_list(char *);
65 extern int get_stram_list(char *);
66 extern int get_filesystem_list(char *);
67 extern int get_exec_domain_list(char *);
68 extern int get_dma_list(char *);
69 extern int get_locks_status (char *, char **, off_t, int);
71 static int proc_calc_metrics(char *page, char **start, off_t off,
72 int count, int *eof, int len)
74 if (len <= off+count) *eof = 1;
75 *start = page + off;
76 len -= off;
77 if (len>count) len = count;
78 if (len<0) len = 0;
79 return len;
82 static int loadavg_read_proc(char *page, char **start, off_t off,
83 int count, int *eof, void *data)
85 int a, b, c;
86 int len;
88 a = avenrun[0] + (FIXED_1/200);
89 b = avenrun[1] + (FIXED_1/200);
90 c = avenrun[2] + (FIXED_1/200);
91 len = sprintf(page,"%d.%02d %d.%02d %d.%02d %ld/%d %d\n",
92 LOAD_INT(a), LOAD_FRAC(a),
93 LOAD_INT(b), LOAD_FRAC(b),
94 LOAD_INT(c), LOAD_FRAC(c),
95 nr_running(), nr_threads, current->nsproxy->pid_ns->last_pid);
96 return proc_calc_metrics(page, start, off, count, eof, len);
99 static int uptime_read_proc(char *page, char **start, off_t off,
100 int count, int *eof, void *data)
102 struct timespec uptime;
103 struct timespec idle;
104 int len;
105 cputime_t idletime = cputime_add(init_task.utime, init_task.stime);
107 do_posix_clock_monotonic_gettime(&uptime);
108 cputime_to_timespec(idletime, &idle);
109 len = sprintf(page,"%lu.%02lu %lu.%02lu\n",
110 (unsigned long) uptime.tv_sec,
111 (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
112 (unsigned long) idle.tv_sec,
113 (idle.tv_nsec / (NSEC_PER_SEC / 100)));
115 return proc_calc_metrics(page, start, off, count, eof, len);
118 static int meminfo_read_proc(char *page, char **start, off_t off,
119 int count, int *eof, void *data)
121 struct sysinfo i;
122 int len;
123 unsigned long committed;
124 unsigned long allowed;
125 struct vmalloc_info vmi;
126 long cached;
129 * display in kilobytes.
131 #define K(x) ((x) << (PAGE_SHIFT - 10))
132 si_meminfo(&i);
133 si_swapinfo(&i);
134 committed = atomic_read(&vm_committed_space);
135 allowed = ((totalram_pages - hugetlb_total_pages())
136 * sysctl_overcommit_ratio / 100) + total_swap_pages;
138 cached = global_page_state(NR_FILE_PAGES) -
139 total_swapcache_pages - i.bufferram;
140 if (cached < 0)
141 cached = 0;
143 get_vmalloc_info(&vmi);
146 * Tagged format, for easy grepping and expansion.
148 len = sprintf(page,
149 "MemTotal: %8lu kB\n"
150 "MemFree: %8lu kB\n"
151 "Buffers: %8lu kB\n"
152 "Cached: %8lu kB\n"
153 "SwapCached: %8lu kB\n"
154 "Active: %8lu kB\n"
155 "Inactive: %8lu kB\n"
156 #ifdef CONFIG_HIGHMEM
157 "HighTotal: %8lu kB\n"
158 "HighFree: %8lu kB\n"
159 "LowTotal: %8lu kB\n"
160 "LowFree: %8lu kB\n"
161 #endif
162 "SwapTotal: %8lu kB\n"
163 "SwapFree: %8lu kB\n"
164 "Dirty: %8lu kB\n"
165 "Writeback: %8lu kB\n"
166 "AnonPages: %8lu kB\n"
167 "Mapped: %8lu kB\n"
168 "Slab: %8lu kB\n"
169 "SReclaimable: %8lu kB\n"
170 "SUnreclaim: %8lu kB\n"
171 "PageTables: %8lu kB\n"
172 "NFS_Unstable: %8lu kB\n"
173 "Bounce: %8lu kB\n"
174 "WritebackTmp: %8lu kB\n"
175 "CommitLimit: %8lu kB\n"
176 "Committed_AS: %8lu kB\n"
177 "VmallocTotal: %8lu kB\n"
178 "VmallocUsed: %8lu kB\n"
179 "VmallocChunk: %8lu kB\n",
180 K(i.totalram),
181 K(i.freeram),
182 K(i.bufferram),
183 K(cached),
184 K(total_swapcache_pages),
185 K(global_page_state(NR_ACTIVE)),
186 K(global_page_state(NR_INACTIVE)),
187 #ifdef CONFIG_HIGHMEM
188 K(i.totalhigh),
189 K(i.freehigh),
190 K(i.totalram-i.totalhigh),
191 K(i.freeram-i.freehigh),
192 #endif
193 K(i.totalswap),
194 K(i.freeswap),
195 K(global_page_state(NR_FILE_DIRTY)),
196 K(global_page_state(NR_WRITEBACK)),
197 K(global_page_state(NR_ANON_PAGES)),
198 K(global_page_state(NR_FILE_MAPPED)),
199 K(global_page_state(NR_SLAB_RECLAIMABLE) +
200 global_page_state(NR_SLAB_UNRECLAIMABLE)),
201 K(global_page_state(NR_SLAB_RECLAIMABLE)),
202 K(global_page_state(NR_SLAB_UNRECLAIMABLE)),
203 K(global_page_state(NR_PAGETABLE)),
204 K(global_page_state(NR_UNSTABLE_NFS)),
205 K(global_page_state(NR_BOUNCE)),
206 K(global_page_state(NR_WRITEBACK_TEMP)),
207 K(allowed),
208 K(committed),
209 (unsigned long)VMALLOC_TOTAL >> 10,
210 vmi.used >> 10,
211 vmi.largest_chunk >> 10
214 len += hugetlb_report_meminfo(page + len);
216 return proc_calc_metrics(page, start, off, count, eof, len);
217 #undef K
220 extern struct seq_operations fragmentation_op;
221 static int fragmentation_open(struct inode *inode, struct file *file)
223 (void)inode;
224 return seq_open(file, &fragmentation_op);
227 static const struct file_operations fragmentation_file_operations = {
228 .open = fragmentation_open,
229 .read = seq_read,
230 .llseek = seq_lseek,
231 .release = seq_release,
234 extern struct seq_operations zoneinfo_op;
235 static int zoneinfo_open(struct inode *inode, struct file *file)
237 return seq_open(file, &zoneinfo_op);
240 static const struct file_operations proc_zoneinfo_file_operations = {
241 .open = zoneinfo_open,
242 .read = seq_read,
243 .llseek = seq_lseek,
244 .release = seq_release,
247 static int version_read_proc(char *page, char **start, off_t off,
248 int count, int *eof, void *data)
250 int len;
252 len = snprintf(page, PAGE_SIZE, linux_proc_banner,
253 utsname()->sysname,
254 utsname()->release,
255 utsname()->version);
256 return proc_calc_metrics(page, start, off, count, eof, len);
259 extern struct seq_operations cpuinfo_op;
260 static int cpuinfo_open(struct inode *inode, struct file *file)
262 return seq_open(file, &cpuinfo_op);
265 static const struct file_operations proc_cpuinfo_operations = {
266 .open = cpuinfo_open,
267 .read = seq_read,
268 .llseek = seq_lseek,
269 .release = seq_release,
272 static int devinfo_show(struct seq_file *f, void *v)
274 int i = *(loff_t *) v;
276 if (i < CHRDEV_MAJOR_HASH_SIZE) {
277 if (i == 0)
278 seq_printf(f, "Character devices:\n");
279 chrdev_show(f, i);
281 #ifdef CONFIG_BLOCK
282 else {
283 i -= CHRDEV_MAJOR_HASH_SIZE;
284 if (i == 0)
285 seq_printf(f, "\nBlock devices:\n");
286 blkdev_show(f, i);
288 #endif
289 return 0;
292 static void *devinfo_start(struct seq_file *f, loff_t *pos)
294 if (*pos < (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE))
295 return pos;
296 return NULL;
299 static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos)
301 (*pos)++;
302 if (*pos >= (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE))
303 return NULL;
304 return pos;
307 static void devinfo_stop(struct seq_file *f, void *v)
309 /* Nothing to do */
312 static struct seq_operations devinfo_ops = {
313 .start = devinfo_start,
314 .next = devinfo_next,
315 .stop = devinfo_stop,
316 .show = devinfo_show
319 static int devinfo_open(struct inode *inode, struct file *filp)
321 return seq_open(filp, &devinfo_ops);
324 static const struct file_operations proc_devinfo_operations = {
325 .open = devinfo_open,
326 .read = seq_read,
327 .llseek = seq_lseek,
328 .release = seq_release,
331 extern struct seq_operations vmstat_op;
332 static int vmstat_open(struct inode *inode, struct file *file)
334 return seq_open(file, &vmstat_op);
336 static const struct file_operations proc_vmstat_file_operations = {
337 .open = vmstat_open,
338 .read = seq_read,
339 .llseek = seq_lseek,
340 .release = seq_release,
343 #ifdef CONFIG_PROC_HARDWARE
344 static int hardware_read_proc(char *page, char **start, off_t off,
345 int count, int *eof, void *data)
347 int len = get_hardware_list(page);
348 return proc_calc_metrics(page, start, off, count, eof, len);
350 #endif
352 #ifdef CONFIG_STRAM_PROC
353 static int stram_read_proc(char *page, char **start, off_t off,
354 int count, int *eof, void *data)
356 int len = get_stram_list(page);
357 return proc_calc_metrics(page, start, off, count, eof, len);
359 #endif
361 #ifdef CONFIG_BLOCK
362 extern struct seq_operations partitions_op;
363 static int partitions_open(struct inode *inode, struct file *file)
365 return seq_open(file, &partitions_op);
367 static const struct file_operations proc_partitions_operations = {
368 .open = partitions_open,
369 .read = seq_read,
370 .llseek = seq_lseek,
371 .release = seq_release,
374 extern struct seq_operations diskstats_op;
375 static int diskstats_open(struct inode *inode, struct file *file)
377 return seq_open(file, &diskstats_op);
379 static const struct file_operations proc_diskstats_operations = {
380 .open = diskstats_open,
381 .read = seq_read,
382 .llseek = seq_lseek,
383 .release = seq_release,
385 #endif
387 #ifdef CONFIG_MODULES
388 extern struct seq_operations modules_op;
389 static int modules_open(struct inode *inode, struct file *file)
391 return seq_open(file, &modules_op);
393 static const struct file_operations proc_modules_operations = {
394 .open = modules_open,
395 .read = seq_read,
396 .llseek = seq_lseek,
397 .release = seq_release,
399 #endif
401 #if defined(CONFIG_SLAB) || defined(CONFIG_SLUB)
402 static int slabinfo_open(struct inode *inode, struct file *file)
404 return seq_open(file, &slabinfo_op);
406 static const struct file_operations proc_slabinfo_operations = {
407 .open = slabinfo_open,
408 .read = seq_read,
409 #ifdef CONFIG_SLAB
410 .write = slabinfo_write,
411 #endif
412 .llseek = seq_lseek,
413 .release = seq_release,
416 #ifdef CONFIG_DEBUG_SLAB_LEAK
417 extern struct seq_operations slabstats_op;
418 static int slabstats_open(struct inode *inode, struct file *file)
420 unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL);
421 int ret = -ENOMEM;
422 if (n) {
423 ret = seq_open(file, &slabstats_op);
424 if (!ret) {
425 struct seq_file *m = file->private_data;
426 *n = PAGE_SIZE / (2 * sizeof(unsigned long));
427 m->private = n;
428 n = NULL;
430 kfree(n);
432 return ret;
435 static const struct file_operations proc_slabstats_operations = {
436 .open = slabstats_open,
437 .read = seq_read,
438 .llseek = seq_lseek,
439 .release = seq_release_private,
441 #endif
442 #endif
444 static int show_stat(struct seq_file *p, void *v)
446 int i;
447 unsigned long jif;
448 cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
449 u64 sum = 0;
451 user = nice = system = idle = iowait =
452 irq = softirq = steal = cputime64_zero;
453 jif = - wall_to_monotonic.tv_sec;
454 if (wall_to_monotonic.tv_nsec)
455 --jif;
457 for_each_possible_cpu(i) {
458 int j;
460 user = cputime64_add(user, kstat_cpu(i).cpustat.user);
461 nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice);
462 system = cputime64_add(system, kstat_cpu(i).cpustat.system);
463 idle = cputime64_add(idle, kstat_cpu(i).cpustat.idle);
464 iowait = cputime64_add(iowait, kstat_cpu(i).cpustat.iowait);
465 irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq);
466 softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
467 steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
468 for (j = 0 ; j < NR_IRQS ; j++)
469 sum += kstat_cpu(i).irqs[j];
472 seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu\n",
473 (unsigned long long)cputime64_to_clock_t(user),
474 (unsigned long long)cputime64_to_clock_t(nice),
475 (unsigned long long)cputime64_to_clock_t(system),
476 (unsigned long long)cputime64_to_clock_t(idle),
477 (unsigned long long)cputime64_to_clock_t(iowait),
478 (unsigned long long)cputime64_to_clock_t(irq),
479 (unsigned long long)cputime64_to_clock_t(softirq),
480 (unsigned long long)cputime64_to_clock_t(steal));
481 for_each_online_cpu(i) {
483 /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
484 user = kstat_cpu(i).cpustat.user;
485 nice = kstat_cpu(i).cpustat.nice;
486 system = kstat_cpu(i).cpustat.system;
487 idle = kstat_cpu(i).cpustat.idle;
488 iowait = kstat_cpu(i).cpustat.iowait;
489 irq = kstat_cpu(i).cpustat.irq;
490 softirq = kstat_cpu(i).cpustat.softirq;
491 steal = kstat_cpu(i).cpustat.steal;
492 seq_printf(p, "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu\n",
494 (unsigned long long)cputime64_to_clock_t(user),
495 (unsigned long long)cputime64_to_clock_t(nice),
496 (unsigned long long)cputime64_to_clock_t(system),
497 (unsigned long long)cputime64_to_clock_t(idle),
498 (unsigned long long)cputime64_to_clock_t(iowait),
499 (unsigned long long)cputime64_to_clock_t(irq),
500 (unsigned long long)cputime64_to_clock_t(softirq),
501 (unsigned long long)cputime64_to_clock_t(steal));
503 seq_printf(p, "intr %llu", (unsigned long long)sum);
505 #if !defined(CONFIG_PPC64) && !defined(CONFIG_ALPHA) && !defined(CONFIG_IA64)
506 for (i = 0; i < NR_IRQS; i++)
507 seq_printf(p, " %u", kstat_irqs(i));
508 #endif
510 seq_printf(p,
511 "\nctxt %llu\n"
512 "btime %lu\n"
513 "processes %lu\n"
514 "procs_running %lu\n"
515 "procs_blocked %lu\n",
516 nr_context_switches(),
517 (unsigned long)jif,
518 total_forks,
519 nr_running(),
520 nr_iowait());
522 return 0;
525 static int stat_open(struct inode *inode, struct file *file)
527 unsigned size = 4096 * (1 + num_possible_cpus() / 32);
528 char *buf;
529 struct seq_file *m;
530 int res;
532 /* don't ask for more than the kmalloc() max size, currently 128 KB */
533 if (size > 128 * 1024)
534 size = 128 * 1024;
535 buf = kmalloc(size, GFP_KERNEL);
536 if (!buf)
537 return -ENOMEM;
539 res = single_open(file, show_stat, NULL);
540 if (!res) {
541 m = file->private_data;
542 m->buf = buf;
543 m->size = size;
544 } else
545 kfree(buf);
546 return res;
548 static const struct file_operations proc_stat_operations = {
549 .open = stat_open,
550 .read = seq_read,
551 .llseek = seq_lseek,
552 .release = single_release,
556 * /proc/interrupts
558 static void *int_seq_start(struct seq_file *f, loff_t *pos)
560 return (*pos <= NR_IRQS) ? pos : NULL;
563 static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
565 (*pos)++;
566 if (*pos > NR_IRQS)
567 return NULL;
568 return pos;
571 static void int_seq_stop(struct seq_file *f, void *v)
573 /* Nothing to do */
577 extern int show_interrupts(struct seq_file *f, void *v); /* In arch code */
578 static struct seq_operations int_seq_ops = {
579 .start = int_seq_start,
580 .next = int_seq_next,
581 .stop = int_seq_stop,
582 .show = show_interrupts
585 static int interrupts_open(struct inode *inode, struct file *filp)
587 return seq_open(filp, &int_seq_ops);
590 static const struct file_operations proc_interrupts_operations = {
591 .open = interrupts_open,
592 .read = seq_read,
593 .llseek = seq_lseek,
594 .release = seq_release,
597 static int filesystems_read_proc(char *page, char **start, off_t off,
598 int count, int *eof, void *data)
600 int len = get_filesystem_list(page);
601 return proc_calc_metrics(page, start, off, count, eof, len);
604 static int cmdline_read_proc(char *page, char **start, off_t off,
605 int count, int *eof, void *data)
607 int len;
609 len = sprintf(page, "%s\n", saved_command_line);
610 return proc_calc_metrics(page, start, off, count, eof, len);
613 static int locks_read_proc(char *page, char **start, off_t off,
614 int count, int *eof, void *data)
616 int len = get_locks_status(page, start, off, count);
618 if (len < count)
619 *eof = 1;
620 return len;
623 static int execdomains_read_proc(char *page, char **start, off_t off,
624 int count, int *eof, void *data)
626 int len = get_exec_domain_list(page);
627 return proc_calc_metrics(page, start, off, count, eof, len);
630 #ifdef CONFIG_SHRINKMEM
631 #define ALLPAGES 1024
632 extern unsigned long shrink_all_memory(unsigned long nr_pages);
633 static int shrinkmem_read_proc(char *page, char **start, off_t off,
634 int count, int *eof, void *data)
636 int len;
638 shrink_all_memory(ALLPAGES);
639 return proc_calc_metrics(page, start, off, count, eof, len);
641 #endif
643 #ifdef CONFIG_MAGIC_SYSRQ
645 * writing 'C' to /proc/sysrq-trigger is like sysrq-C
647 static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
648 size_t count, loff_t *ppos)
650 if (count) {
651 char c;
653 if (get_user(c, buf))
654 return -EFAULT;
655 __handle_sysrq(c, NULL, 0);
657 return count;
660 static const struct file_operations proc_sysrq_trigger_operations = {
661 .write = write_sysrq_trigger,
663 #endif
665 struct proc_dir_entry *proc_root_kcore;
667 void create_seq_entry(char *name, mode_t mode, const struct file_operations *f)
669 struct proc_dir_entry *entry;
670 entry = create_proc_entry(name, mode, NULL);
671 if (entry)
672 entry->proc_fops = f;
675 void __init proc_misc_init(void)
677 static struct {
678 char *name;
679 int (*read_proc)(char*,char**,off_t,int,int*,void*);
680 } *p, simple_ones[] = {
681 {"loadavg", loadavg_read_proc},
682 {"uptime", uptime_read_proc},
683 {"meminfo", meminfo_read_proc},
684 {"version", version_read_proc},
685 #ifdef CONFIG_PROC_HARDWARE
686 {"hardware", hardware_read_proc},
687 #endif
688 #ifdef CONFIG_STRAM_PROC
689 {"stram", stram_read_proc},
690 #endif
691 {"filesystems", filesystems_read_proc},
692 {"cmdline", cmdline_read_proc},
693 {"locks", locks_read_proc},
694 {"execdomains", execdomains_read_proc},
695 #ifdef CONFIG_SHRINKMEM
696 {"shrinkmem", shrinkmem_read_proc},
697 #endif
698 {NULL,}
700 for (p = simple_ones; p->name; p++)
701 create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);
703 proc_symlink("mounts", NULL, "self/mounts");
705 /* And now for trickier ones */
706 #ifdef CONFIG_PRINTK
708 struct proc_dir_entry *entry;
709 entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
710 if (entry)
711 entry->proc_fops = &proc_kmsg_operations;
713 #endif
714 create_seq_entry("devices", 0, &proc_devinfo_operations);
715 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
716 #ifdef CONFIG_BLOCK
717 create_seq_entry("partitions", 0, &proc_partitions_operations);
718 #endif
719 create_seq_entry("stat", 0, &proc_stat_operations);
720 create_seq_entry("interrupts", 0, &proc_interrupts_operations);
721 #if defined(CONFIG_SLAB) || defined(CONFIG_SLUB)
722 create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
723 #ifdef CONFIG_DEBUG_SLAB_LEAK
724 create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations);
725 #endif
726 #endif
727 create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations);
728 create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations);
729 create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations);
730 #ifdef CONFIG_BLOCK
731 create_seq_entry("diskstats", 0, &proc_diskstats_operations);
732 #endif
733 #ifdef CONFIG_MODULES
734 create_seq_entry("modules", 0, &proc_modules_operations);
735 #endif
736 #ifdef CONFIG_SCHEDSTATS
737 create_seq_entry("schedstat", 0, &proc_schedstat_operations);
738 #endif
739 #ifdef CONFIG_PROC_KCORE
740 proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL);
741 if (proc_root_kcore) {
742 proc_root_kcore->proc_fops = &proc_kcore_operations;
743 proc_root_kcore->size =
744 (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
746 #endif
747 #ifdef CONFIG_PROC_VMCORE
748 proc_vmcore = create_proc_entry("vmcore", S_IRUSR, NULL);
749 if (proc_vmcore)
750 proc_vmcore->proc_fops = &proc_vmcore_operations;
751 #endif
752 #ifdef CONFIG_MAGIC_SYSRQ
754 struct proc_dir_entry *entry;
755 entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL);
756 if (entry)
757 entry->proc_fops = &proc_sysrq_trigger_operations;
759 #endif