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