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