[SCSI] scsi_scan: fix report lun problems with CDROM or RBC devices
[linux-2.6/linux-2.6-openrd.git] / fs / proc / proc_misc.c
blob92ea7743fe8f59dd97f925b8e7923a463fb5b022
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/smp_lock.h>
39 #include <linux/seq_file.h>
40 #include <linux/times.h>
41 #include <linux/profile.h>
42 #include <linux/utsname.h>
43 #include <linux/blkdev.h>
44 #include <linux/hugetlb.h>
45 #include <linux/jiffies.h>
46 #include <linux/sysrq.h>
47 #include <linux/vmalloc.h>
48 #include <linux/crash_dump.h>
49 #include <linux/pid_namespace.h>
50 #include <linux/compile.h>
51 #include <asm/uaccess.h>
52 #include <asm/pgtable.h>
53 #include <asm/io.h>
54 #include <asm/tlb.h>
55 #include <asm/div64.h>
56 #include "internal.h"
58 #define LOAD_INT(x) ((x) >> FSHIFT)
59 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
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.
66 extern int get_hardware_list(char *);
67 extern int get_stram_list(char *);
68 extern int get_filesystem_list(char *);
69 extern int get_exec_domain_list(char *);
70 extern int get_dma_list(char *);
71 extern int get_locks_status (char *, char **, off_t, int);
73 static int proc_calc_metrics(char *page, char **start, off_t off,
74 int count, int *eof, int len)
76 if (len <= off+count) *eof = 1;
77 *start = page + off;
78 len -= off;
79 if (len>count) len = count;
80 if (len<0) len = 0;
81 return len;
84 static int loadavg_read_proc(char *page, char **start, off_t off,
85 int count, int *eof, void *data)
87 int a, b, c;
88 int len;
90 a = avenrun[0] + (FIXED_1/200);
91 b = avenrun[1] + (FIXED_1/200);
92 c = avenrun[2] + (FIXED_1/200);
93 len = sprintf(page,"%d.%02d %d.%02d %d.%02d %ld/%d %d\n",
94 LOAD_INT(a), LOAD_FRAC(a),
95 LOAD_INT(b), LOAD_FRAC(b),
96 LOAD_INT(c), LOAD_FRAC(c),
97 nr_running(), nr_threads, current->nsproxy->pid_ns->last_pid);
98 return proc_calc_metrics(page, start, off, count, eof, len);
101 static int uptime_read_proc(char *page, char **start, off_t off,
102 int count, int *eof, void *data)
104 struct timespec uptime;
105 struct timespec idle;
106 int len;
107 cputime_t idletime = cputime_add(init_task.utime, init_task.stime);
109 do_posix_clock_monotonic_gettime(&uptime);
110 cputime_to_timespec(idletime, &idle);
111 len = sprintf(page,"%lu.%02lu %lu.%02lu\n",
112 (unsigned long) uptime.tv_sec,
113 (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
114 (unsigned long) idle.tv_sec,
115 (idle.tv_nsec / (NSEC_PER_SEC / 100)));
117 return proc_calc_metrics(page, start, off, count, eof, len);
120 static int meminfo_read_proc(char *page, char **start, off_t off,
121 int count, int *eof, void *data)
123 struct sysinfo i;
124 int len;
125 unsigned long inactive;
126 unsigned long active;
127 unsigned long free;
128 unsigned long committed;
129 unsigned long allowed;
130 struct vmalloc_info vmi;
131 long cached;
133 get_zone_counts(&active, &inactive, &free);
136 * display in kilobytes.
138 #define K(x) ((x) << (PAGE_SHIFT - 10))
139 si_meminfo(&i);
140 si_swapinfo(&i);
141 committed = atomic_read(&vm_committed_space);
142 allowed = ((totalram_pages - hugetlb_total_pages())
143 * sysctl_overcommit_ratio / 100) + total_swap_pages;
145 cached = global_page_state(NR_FILE_PAGES) -
146 total_swapcache_pages - i.bufferram;
147 if (cached < 0)
148 cached = 0;
150 get_vmalloc_info(&vmi);
153 * Tagged format, for easy grepping and expansion.
155 len = sprintf(page,
156 "MemTotal: %8lu kB\n"
157 "MemFree: %8lu kB\n"
158 "Buffers: %8lu kB\n"
159 "Cached: %8lu kB\n"
160 "SwapCached: %8lu kB\n"
161 "Active: %8lu kB\n"
162 "Inactive: %8lu kB\n"
163 #ifdef CONFIG_HIGHMEM
164 "HighTotal: %8lu kB\n"
165 "HighFree: %8lu kB\n"
166 "LowTotal: %8lu kB\n"
167 "LowFree: %8lu kB\n"
168 #endif
169 "SwapTotal: %8lu kB\n"
170 "SwapFree: %8lu kB\n"
171 "Dirty: %8lu kB\n"
172 "Writeback: %8lu kB\n"
173 "AnonPages: %8lu kB\n"
174 "Mapped: %8lu kB\n"
175 "Slab: %8lu kB\n"
176 "SReclaimable: %8lu kB\n"
177 "SUnreclaim: %8lu kB\n"
178 "PageTables: %8lu kB\n"
179 "NFS_Unstable: %8lu kB\n"
180 "Bounce: %8lu kB\n"
181 "CommitLimit: %8lu kB\n"
182 "Committed_AS: %8lu kB\n"
183 "VmallocTotal: %8lu kB\n"
184 "VmallocUsed: %8lu kB\n"
185 "VmallocChunk: %8lu kB\n",
186 K(i.totalram),
187 K(i.freeram),
188 K(i.bufferram),
189 K(cached),
190 K(total_swapcache_pages),
191 K(active),
192 K(inactive),
193 #ifdef CONFIG_HIGHMEM
194 K(i.totalhigh),
195 K(i.freehigh),
196 K(i.totalram-i.totalhigh),
197 K(i.freeram-i.freehigh),
198 #endif
199 K(i.totalswap),
200 K(i.freeswap),
201 K(global_page_state(NR_FILE_DIRTY)),
202 K(global_page_state(NR_WRITEBACK)),
203 K(global_page_state(NR_ANON_PAGES)),
204 K(global_page_state(NR_FILE_MAPPED)),
205 K(global_page_state(NR_SLAB_RECLAIMABLE) +
206 global_page_state(NR_SLAB_UNRECLAIMABLE)),
207 K(global_page_state(NR_SLAB_RECLAIMABLE)),
208 K(global_page_state(NR_SLAB_UNRECLAIMABLE)),
209 K(global_page_state(NR_PAGETABLE)),
210 K(global_page_state(NR_UNSTABLE_NFS)),
211 K(global_page_state(NR_BOUNCE)),
212 K(allowed),
213 K(committed),
214 (unsigned long)VMALLOC_TOTAL >> 10,
215 vmi.used >> 10,
216 vmi.largest_chunk >> 10
219 len += hugetlb_report_meminfo(page + len);
221 return proc_calc_metrics(page, start, off, count, eof, len);
222 #undef K
225 extern struct seq_operations fragmentation_op;
226 static int fragmentation_open(struct inode *inode, struct file *file)
228 (void)inode;
229 return seq_open(file, &fragmentation_op);
232 static struct file_operations fragmentation_file_operations = {
233 .open = fragmentation_open,
234 .read = seq_read,
235 .llseek = seq_lseek,
236 .release = seq_release,
239 extern struct seq_operations zoneinfo_op;
240 static int zoneinfo_open(struct inode *inode, struct file *file)
242 return seq_open(file, &zoneinfo_op);
245 static struct file_operations proc_zoneinfo_file_operations = {
246 .open = zoneinfo_open,
247 .read = seq_read,
248 .llseek = seq_lseek,
249 .release = seq_release,
252 static int version_read_proc(char *page, char **start, off_t off,
253 int count, int *eof, void *data)
255 int len;
257 /* FIXED STRING! Don't touch! */
258 len = snprintf(page, PAGE_SIZE,
259 "%s version %s"
260 " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
261 " (" LINUX_COMPILER ")"
262 " %s\n",
263 utsname()->sysname,
264 utsname()->release,
265 utsname()->version);
266 return proc_calc_metrics(page, start, off, count, eof, len);
269 extern struct seq_operations cpuinfo_op;
270 static int cpuinfo_open(struct inode *inode, struct file *file)
272 return seq_open(file, &cpuinfo_op);
275 static struct file_operations proc_cpuinfo_operations = {
276 .open = cpuinfo_open,
277 .read = seq_read,
278 .llseek = seq_lseek,
279 .release = seq_release,
282 static int devinfo_show(struct seq_file *f, void *v)
284 int i = *(loff_t *) v;
286 if (i < CHRDEV_MAJOR_HASH_SIZE) {
287 if (i == 0)
288 seq_printf(f, "Character devices:\n");
289 chrdev_show(f, i);
291 #ifdef CONFIG_BLOCK
292 else {
293 i -= CHRDEV_MAJOR_HASH_SIZE;
294 if (i == 0)
295 seq_printf(f, "\nBlock devices:\n");
296 blkdev_show(f, i);
298 #endif
299 return 0;
302 static void *devinfo_start(struct seq_file *f, loff_t *pos)
304 if (*pos < (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE))
305 return pos;
306 return NULL;
309 static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos)
311 (*pos)++;
312 if (*pos >= (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE))
313 return NULL;
314 return pos;
317 static void devinfo_stop(struct seq_file *f, void *v)
319 /* Nothing to do */
322 static struct seq_operations devinfo_ops = {
323 .start = devinfo_start,
324 .next = devinfo_next,
325 .stop = devinfo_stop,
326 .show = devinfo_show
329 static int devinfo_open(struct inode *inode, struct file *filp)
331 return seq_open(filp, &devinfo_ops);
334 static struct file_operations proc_devinfo_operations = {
335 .open = devinfo_open,
336 .read = seq_read,
337 .llseek = seq_lseek,
338 .release = seq_release,
341 extern struct seq_operations vmstat_op;
342 static int vmstat_open(struct inode *inode, struct file *file)
344 return seq_open(file, &vmstat_op);
346 static struct file_operations proc_vmstat_file_operations = {
347 .open = vmstat_open,
348 .read = seq_read,
349 .llseek = seq_lseek,
350 .release = seq_release,
353 #ifdef CONFIG_PROC_HARDWARE
354 static int hardware_read_proc(char *page, char **start, off_t off,
355 int count, int *eof, void *data)
357 int len = get_hardware_list(page);
358 return proc_calc_metrics(page, start, off, count, eof, len);
360 #endif
362 #ifdef CONFIG_STRAM_PROC
363 static int stram_read_proc(char *page, char **start, off_t off,
364 int count, int *eof, void *data)
366 int len = get_stram_list(page);
367 return proc_calc_metrics(page, start, off, count, eof, len);
369 #endif
371 #ifdef CONFIG_BLOCK
372 extern struct seq_operations partitions_op;
373 static int partitions_open(struct inode *inode, struct file *file)
375 return seq_open(file, &partitions_op);
377 static struct file_operations proc_partitions_operations = {
378 .open = partitions_open,
379 .read = seq_read,
380 .llseek = seq_lseek,
381 .release = seq_release,
384 extern struct seq_operations diskstats_op;
385 static int diskstats_open(struct inode *inode, struct file *file)
387 return seq_open(file, &diskstats_op);
389 static struct file_operations proc_diskstats_operations = {
390 .open = diskstats_open,
391 .read = seq_read,
392 .llseek = seq_lseek,
393 .release = seq_release,
395 #endif
397 #ifdef CONFIG_MODULES
398 extern struct seq_operations modules_op;
399 static int modules_open(struct inode *inode, struct file *file)
401 return seq_open(file, &modules_op);
403 static struct file_operations proc_modules_operations = {
404 .open = modules_open,
405 .read = seq_read,
406 .llseek = seq_lseek,
407 .release = seq_release,
409 #endif
411 #ifdef CONFIG_SLAB
412 extern struct seq_operations slabinfo_op;
413 extern ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
414 static int slabinfo_open(struct inode *inode, struct file *file)
416 return seq_open(file, &slabinfo_op);
418 static struct file_operations proc_slabinfo_operations = {
419 .open = slabinfo_open,
420 .read = seq_read,
421 .write = slabinfo_write,
422 .llseek = seq_lseek,
423 .release = seq_release,
426 #ifdef CONFIG_DEBUG_SLAB_LEAK
427 extern struct seq_operations slabstats_op;
428 static int slabstats_open(struct inode *inode, struct file *file)
430 unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL);
431 int ret = -ENOMEM;
432 if (n) {
433 ret = seq_open(file, &slabstats_op);
434 if (!ret) {
435 struct seq_file *m = file->private_data;
436 *n = PAGE_SIZE / (2 * sizeof(unsigned long));
437 m->private = n;
438 n = NULL;
440 kfree(n);
442 return ret;
445 static int slabstats_release(struct inode *inode, struct file *file)
447 struct seq_file *m = file->private_data;
448 kfree(m->private);
449 return seq_release(inode, file);
452 static struct file_operations proc_slabstats_operations = {
453 .open = slabstats_open,
454 .read = seq_read,
455 .llseek = seq_lseek,
456 .release = slabstats_release,
458 #endif
459 #endif
461 static int show_stat(struct seq_file *p, void *v)
463 int i;
464 unsigned long jif;
465 cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
466 u64 sum = 0;
468 user = nice = system = idle = iowait =
469 irq = softirq = steal = cputime64_zero;
470 jif = - wall_to_monotonic.tv_sec;
471 if (wall_to_monotonic.tv_nsec)
472 --jif;
474 for_each_possible_cpu(i) {
475 int j;
477 user = cputime64_add(user, kstat_cpu(i).cpustat.user);
478 nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice);
479 system = cputime64_add(system, kstat_cpu(i).cpustat.system);
480 idle = cputime64_add(idle, kstat_cpu(i).cpustat.idle);
481 iowait = cputime64_add(iowait, kstat_cpu(i).cpustat.iowait);
482 irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq);
483 softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
484 steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
485 for (j = 0 ; j < NR_IRQS ; j++)
486 sum += kstat_cpu(i).irqs[j];
489 seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu\n",
490 (unsigned long long)cputime64_to_clock_t(user),
491 (unsigned long long)cputime64_to_clock_t(nice),
492 (unsigned long long)cputime64_to_clock_t(system),
493 (unsigned long long)cputime64_to_clock_t(idle),
494 (unsigned long long)cputime64_to_clock_t(iowait),
495 (unsigned long long)cputime64_to_clock_t(irq),
496 (unsigned long long)cputime64_to_clock_t(softirq),
497 (unsigned long long)cputime64_to_clock_t(steal));
498 for_each_online_cpu(i) {
500 /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
501 user = kstat_cpu(i).cpustat.user;
502 nice = kstat_cpu(i).cpustat.nice;
503 system = kstat_cpu(i).cpustat.system;
504 idle = kstat_cpu(i).cpustat.idle;
505 iowait = kstat_cpu(i).cpustat.iowait;
506 irq = kstat_cpu(i).cpustat.irq;
507 softirq = kstat_cpu(i).cpustat.softirq;
508 steal = kstat_cpu(i).cpustat.steal;
509 seq_printf(p, "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu\n",
511 (unsigned long long)cputime64_to_clock_t(user),
512 (unsigned long long)cputime64_to_clock_t(nice),
513 (unsigned long long)cputime64_to_clock_t(system),
514 (unsigned long long)cputime64_to_clock_t(idle),
515 (unsigned long long)cputime64_to_clock_t(iowait),
516 (unsigned long long)cputime64_to_clock_t(irq),
517 (unsigned long long)cputime64_to_clock_t(softirq),
518 (unsigned long long)cputime64_to_clock_t(steal));
520 seq_printf(p, "intr %llu", (unsigned long long)sum);
522 #if !defined(CONFIG_PPC64) && !defined(CONFIG_ALPHA) && !defined(CONFIG_IA64)
523 for (i = 0; i < NR_IRQS; i++)
524 seq_printf(p, " %u", kstat_irqs(i));
525 #endif
527 seq_printf(p,
528 "\nctxt %llu\n"
529 "btime %lu\n"
530 "processes %lu\n"
531 "procs_running %lu\n"
532 "procs_blocked %lu\n",
533 nr_context_switches(),
534 (unsigned long)jif,
535 total_forks,
536 nr_running(),
537 nr_iowait());
539 return 0;
542 static int stat_open(struct inode *inode, struct file *file)
544 unsigned size = 4096 * (1 + num_possible_cpus() / 32);
545 char *buf;
546 struct seq_file *m;
547 int res;
549 /* don't ask for more than the kmalloc() max size, currently 128 KB */
550 if (size > 128 * 1024)
551 size = 128 * 1024;
552 buf = kmalloc(size, GFP_KERNEL);
553 if (!buf)
554 return -ENOMEM;
556 res = single_open(file, show_stat, NULL);
557 if (!res) {
558 m = file->private_data;
559 m->buf = buf;
560 m->size = size;
561 } else
562 kfree(buf);
563 return res;
565 static struct file_operations proc_stat_operations = {
566 .open = stat_open,
567 .read = seq_read,
568 .llseek = seq_lseek,
569 .release = single_release,
573 * /proc/interrupts
575 static void *int_seq_start(struct seq_file *f, loff_t *pos)
577 return (*pos <= NR_IRQS) ? pos : NULL;
580 static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
582 (*pos)++;
583 if (*pos > NR_IRQS)
584 return NULL;
585 return pos;
588 static void int_seq_stop(struct seq_file *f, void *v)
590 /* Nothing to do */
594 extern int show_interrupts(struct seq_file *f, void *v); /* In arch code */
595 static struct seq_operations int_seq_ops = {
596 .start = int_seq_start,
597 .next = int_seq_next,
598 .stop = int_seq_stop,
599 .show = show_interrupts
602 static int interrupts_open(struct inode *inode, struct file *filp)
604 return seq_open(filp, &int_seq_ops);
607 static struct file_operations proc_interrupts_operations = {
608 .open = interrupts_open,
609 .read = seq_read,
610 .llseek = seq_lseek,
611 .release = seq_release,
614 static int filesystems_read_proc(char *page, char **start, off_t off,
615 int count, int *eof, void *data)
617 int len = get_filesystem_list(page);
618 return proc_calc_metrics(page, start, off, count, eof, len);
621 static int cmdline_read_proc(char *page, char **start, off_t off,
622 int count, int *eof, void *data)
624 int len;
626 len = sprintf(page, "%s\n", saved_command_line);
627 return proc_calc_metrics(page, start, off, count, eof, len);
630 static int locks_read_proc(char *page, char **start, off_t off,
631 int count, int *eof, void *data)
633 int len = get_locks_status(page, start, off, count);
635 if (len < count)
636 *eof = 1;
637 return len;
640 static int execdomains_read_proc(char *page, char **start, off_t off,
641 int count, int *eof, void *data)
643 int len = get_exec_domain_list(page);
644 return proc_calc_metrics(page, start, off, count, eof, len);
647 #ifdef CONFIG_MAGIC_SYSRQ
649 * writing 'C' to /proc/sysrq-trigger is like sysrq-C
651 static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
652 size_t count, loff_t *ppos)
654 if (count) {
655 char c;
657 if (get_user(c, buf))
658 return -EFAULT;
659 __handle_sysrq(c, NULL, 0);
661 return count;
664 static struct file_operations proc_sysrq_trigger_operations = {
665 .write = write_sysrq_trigger,
667 #endif
669 struct proc_dir_entry *proc_root_kcore;
671 void create_seq_entry(char *name, mode_t mode, const struct file_operations *f)
673 struct proc_dir_entry *entry;
674 entry = create_proc_entry(name, mode, NULL);
675 if (entry)
676 entry->proc_fops = f;
679 void __init proc_misc_init(void)
681 struct proc_dir_entry *entry;
682 static struct {
683 char *name;
684 int (*read_proc)(char*,char**,off_t,int,int*,void*);
685 } *p, simple_ones[] = {
686 {"loadavg", loadavg_read_proc},
687 {"uptime", uptime_read_proc},
688 {"meminfo", meminfo_read_proc},
689 {"version", version_read_proc},
690 #ifdef CONFIG_PROC_HARDWARE
691 {"hardware", hardware_read_proc},
692 #endif
693 #ifdef CONFIG_STRAM_PROC
694 {"stram", stram_read_proc},
695 #endif
696 {"filesystems", filesystems_read_proc},
697 {"cmdline", cmdline_read_proc},
698 {"locks", locks_read_proc},
699 {"execdomains", execdomains_read_proc},
700 {NULL,}
702 for (p = simple_ones; p->name; p++)
703 create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);
705 proc_symlink("mounts", NULL, "self/mounts");
707 /* And now for trickier ones */
708 #ifdef CONFIG_PRINTK
709 entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
710 if (entry)
711 entry->proc_fops = &proc_kmsg_operations;
712 #endif
713 create_seq_entry("devices", 0, &proc_devinfo_operations);
714 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
715 #ifdef CONFIG_BLOCK
716 create_seq_entry("partitions", 0, &proc_partitions_operations);
717 #endif
718 create_seq_entry("stat", 0, &proc_stat_operations);
719 create_seq_entry("interrupts", 0, &proc_interrupts_operations);
720 #ifdef CONFIG_SLAB
721 create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
722 #ifdef CONFIG_DEBUG_SLAB_LEAK
723 create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations);
724 #endif
725 #endif
726 create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations);
727 create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations);
728 create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations);
729 #ifdef CONFIG_BLOCK
730 create_seq_entry("diskstats", 0, &proc_diskstats_operations);
731 #endif
732 #ifdef CONFIG_MODULES
733 create_seq_entry("modules", 0, &proc_modules_operations);
734 #endif
735 #ifdef CONFIG_SCHEDSTATS
736 create_seq_entry("schedstat", 0, &proc_schedstat_operations);
737 #endif
738 #ifdef CONFIG_PROC_KCORE
739 proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL);
740 if (proc_root_kcore) {
741 proc_root_kcore->proc_fops = &proc_kcore_operations;
742 proc_root_kcore->size =
743 (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
745 #endif
746 #ifdef CONFIG_PROC_VMCORE
747 proc_vmcore = create_proc_entry("vmcore", S_IRUSR, NULL);
748 if (proc_vmcore)
749 proc_vmcore->proc_fops = &proc_vmcore_operations;
750 #endif
751 #ifdef CONFIG_MAGIC_SYSRQ
752 entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL);
753 if (entry)
754 entry->proc_fops = &proc_sysrq_trigger_operations;
755 #endif