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