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