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