2 * linux/fs/proc/proc_misc.c
4 * linux/fs/proc/array.c
5 * Copyright (C) 1992 by Linus Torvalds
6 * based on ideas by Darren Senn
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.
14 * Fulton Green : Encapsulated position metric calculations.
15 * <kernel@FultonGreen.com>
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>
24 #include <linux/tty.h>
25 #include <linux/string.h>
26 #include <linux/mman.h>
27 #include <linux/proc_fs.h>
28 #include <linux/ioport.h>
30 #include <linux/mmzone.h>
31 #include <linux/pagemap.h>
32 #include <linux/interrupt.h>
33 #include <linux/swap.h>
34 #include <linux/slab.h>
35 #include <linux/genhd.h>
36 #include <linux/smp.h>
37 #include <linux/signal.h>
38 #include <linux/module.h>
39 #include <linux/init.h>
40 #include <linux/seq_file.h>
41 #include <linux/times.h>
42 #include <linux/profile.h>
43 #include <linux/utsname.h>
44 #include <linux/blkdev.h>
45 #include <linux/hugetlb.h>
46 #include <linux/jiffies.h>
47 #include <linux/sysrq.h>
48 #include <linux/vmalloc.h>
49 #include <linux/crash_dump.h>
50 #include <linux/pid_namespace.h>
51 #include <linux/bootmem.h>
52 #include <asm/uaccess.h>
53 #include <asm/pgtable.h>
56 #include <asm/div64.h>
59 #define LOAD_INT(x) ((x) >> FSHIFT)
60 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
62 * Warning: stuff below (imported functions) assumes that its output will fit
63 * into one page. For some of those functions it may be wrong. Moreover, we
64 * have a way to deal with that gracefully. Right now I used straightforward
65 * wrappers, but this needs further analysis wrt potential overflows.
67 extern int get_hardware_list(char *);
68 extern int get_stram_list(char *);
69 extern int get_exec_domain_list(char *);
70 extern int get_dma_list(char *);
72 static int proc_calc_metrics(char *page
, char **start
, off_t off
,
73 int count
, int *eof
, int len
)
75 if (len
<= off
+count
) *eof
= 1;
78 if (len
>count
) len
= count
;
83 static int loadavg_read_proc(char *page
, char **start
, off_t off
,
84 int count
, int *eof
, void *data
)
91 seq
= read_seqbegin(&xtime_lock
);
92 a
= avenrun
[0] + (FIXED_1
/200);
93 b
= avenrun
[1] + (FIXED_1
/200);
94 c
= avenrun
[2] + (FIXED_1
/200);
95 } while (read_seqretry(&xtime_lock
, seq
));
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
,
102 task_active_pid_ns(current
)->last_pid
);
103 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
106 static int uptime_read_proc(char *page
, char **start
, off_t off
,
107 int count
, int *eof
, void *data
)
109 struct timespec uptime
;
110 struct timespec idle
;
112 cputime_t idletime
= cputime_add(init_task
.utime
, init_task
.stime
);
114 do_posix_clock_monotonic_gettime(&uptime
);
115 monotonic_to_bootbased(&uptime
);
116 cputime_to_timespec(idletime
, &idle
);
117 len
= sprintf(page
,"%lu.%02lu %lu.%02lu\n",
118 (unsigned long) uptime
.tv_sec
,
119 (uptime
.tv_nsec
/ (NSEC_PER_SEC
/ 100)),
120 (unsigned long) idle
.tv_sec
,
121 (idle
.tv_nsec
/ (NSEC_PER_SEC
/ 100)));
123 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
126 int __attribute__((weak
)) arch_report_meminfo(char *page
)
131 static int meminfo_read_proc(char *page
, char **start
, off_t off
,
132 int count
, int *eof
, void *data
)
136 unsigned long committed
;
137 unsigned long allowed
;
138 struct vmalloc_info vmi
;
142 * display in kilobytes.
144 #define K(x) ((x) << (PAGE_SHIFT - 10))
147 committed
= atomic_long_read(&vm_committed_space
);
148 allowed
= ((totalram_pages
- hugetlb_total_pages())
149 * sysctl_overcommit_ratio
/ 100) + total_swap_pages
;
151 cached
= global_page_state(NR_FILE_PAGES
) -
152 total_swapcache_pages
- i
.bufferram
;
156 get_vmalloc_info(&vmi
);
159 * Tagged format, for easy grepping and expansion.
162 "MemTotal: %8lu kB\n"
166 "SwapCached: %8lu kB\n"
168 "Inactive: %8lu kB\n"
169 #ifdef CONFIG_HIGHMEM
170 "HighTotal: %8lu kB\n"
171 "HighFree: %8lu kB\n"
172 "LowTotal: %8lu kB\n"
175 "SwapTotal: %8lu kB\n"
176 "SwapFree: %8lu kB\n"
178 "Writeback: %8lu kB\n"
179 "AnonPages: %8lu kB\n"
182 "SReclaimable: %8lu kB\n"
183 "SUnreclaim: %8lu kB\n"
184 "PageTables: %8lu kB\n"
185 "NFS_Unstable: %8lu kB\n"
187 "WritebackTmp: %8lu kB\n"
188 "CommitLimit: %8lu kB\n"
189 "Committed_AS: %8lu kB\n"
190 "VmallocTotal: %8lu kB\n"
191 "VmallocUsed: %8lu kB\n"
192 "VmallocChunk: %8lu kB\n",
197 K(total_swapcache_pages
),
198 K(global_page_state(NR_ACTIVE
)),
199 K(global_page_state(NR_INACTIVE
)),
200 #ifdef CONFIG_HIGHMEM
203 K(i
.totalram
-i
.totalhigh
),
204 K(i
.freeram
-i
.freehigh
),
208 K(global_page_state(NR_FILE_DIRTY
)),
209 K(global_page_state(NR_WRITEBACK
)),
210 K(global_page_state(NR_ANON_PAGES
)),
211 K(global_page_state(NR_FILE_MAPPED
)),
212 K(global_page_state(NR_SLAB_RECLAIMABLE
) +
213 global_page_state(NR_SLAB_UNRECLAIMABLE
)),
214 K(global_page_state(NR_SLAB_RECLAIMABLE
)),
215 K(global_page_state(NR_SLAB_UNRECLAIMABLE
)),
216 K(global_page_state(NR_PAGETABLE
)),
217 K(global_page_state(NR_UNSTABLE_NFS
)),
218 K(global_page_state(NR_BOUNCE
)),
219 K(global_page_state(NR_WRITEBACK_TEMP
)),
222 (unsigned long)VMALLOC_TOTAL
>> 10,
224 vmi
.largest_chunk
>> 10
227 len
+= hugetlb_report_meminfo(page
+ len
);
229 len
+= arch_report_meminfo(page
+ len
);
231 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
235 static int fragmentation_open(struct inode
*inode
, struct file
*file
)
238 return seq_open(file
, &fragmentation_op
);
241 static const struct file_operations fragmentation_file_operations
= {
242 .open
= fragmentation_open
,
245 .release
= seq_release
,
248 static int pagetypeinfo_open(struct inode
*inode
, struct file
*file
)
250 return seq_open(file
, &pagetypeinfo_op
);
253 static const struct file_operations pagetypeinfo_file_ops
= {
254 .open
= pagetypeinfo_open
,
257 .release
= seq_release
,
260 static int zoneinfo_open(struct inode
*inode
, struct file
*file
)
262 return seq_open(file
, &zoneinfo_op
);
265 static const struct file_operations proc_zoneinfo_file_operations
= {
266 .open
= zoneinfo_open
,
269 .release
= seq_release
,
272 static int version_read_proc(char *page
, char **start
, off_t off
,
273 int count
, int *eof
, void *data
)
277 len
= snprintf(page
, PAGE_SIZE
, linux_proc_banner
,
281 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
284 extern const struct seq_operations cpuinfo_op
;
285 static int cpuinfo_open(struct inode
*inode
, struct file
*file
)
287 return seq_open(file
, &cpuinfo_op
);
290 static const struct file_operations proc_cpuinfo_operations
= {
291 .open
= cpuinfo_open
,
294 .release
= seq_release
,
297 static int devinfo_show(struct seq_file
*f
, void *v
)
299 int i
= *(loff_t
*) v
;
301 if (i
< CHRDEV_MAJOR_HASH_SIZE
) {
303 seq_printf(f
, "Character devices:\n");
308 i
-= CHRDEV_MAJOR_HASH_SIZE
;
310 seq_printf(f
, "\nBlock devices:\n");
317 static void *devinfo_start(struct seq_file
*f
, loff_t
*pos
)
319 if (*pos
< (BLKDEV_MAJOR_HASH_SIZE
+ CHRDEV_MAJOR_HASH_SIZE
))
324 static void *devinfo_next(struct seq_file
*f
, void *v
, loff_t
*pos
)
327 if (*pos
>= (BLKDEV_MAJOR_HASH_SIZE
+ CHRDEV_MAJOR_HASH_SIZE
))
332 static void devinfo_stop(struct seq_file
*f
, void *v
)
337 static const struct seq_operations devinfo_ops
= {
338 .start
= devinfo_start
,
339 .next
= devinfo_next
,
340 .stop
= devinfo_stop
,
344 static int devinfo_open(struct inode
*inode
, struct file
*filp
)
346 return seq_open(filp
, &devinfo_ops
);
349 static const struct file_operations proc_devinfo_operations
= {
350 .open
= devinfo_open
,
353 .release
= seq_release
,
356 static int vmstat_open(struct inode
*inode
, struct file
*file
)
358 return seq_open(file
, &vmstat_op
);
360 static const struct file_operations proc_vmstat_file_operations
= {
364 .release
= seq_release
,
367 #ifdef CONFIG_PROC_HARDWARE
368 static int hardware_read_proc(char *page
, char **start
, off_t off
,
369 int count
, int *eof
, void *data
)
371 int len
= get_hardware_list(page
);
372 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
376 #ifdef CONFIG_STRAM_PROC
377 static int stram_read_proc(char *page
, char **start
, off_t off
,
378 int count
, int *eof
, void *data
)
380 int len
= get_stram_list(page
);
381 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
386 static int partitions_open(struct inode
*inode
, struct file
*file
)
388 return seq_open(file
, &partitions_op
);
390 static const struct file_operations proc_partitions_operations
= {
391 .open
= partitions_open
,
394 .release
= seq_release
,
397 static int diskstats_open(struct inode
*inode
, struct file
*file
)
399 return seq_open(file
, &diskstats_op
);
401 static const struct file_operations proc_diskstats_operations
= {
402 .open
= diskstats_open
,
405 .release
= seq_release
,
409 #ifdef CONFIG_MODULES
410 extern const struct seq_operations modules_op
;
411 static int modules_open(struct inode
*inode
, struct file
*file
)
413 return seq_open(file
, &modules_op
);
415 static const struct file_operations proc_modules_operations
= {
416 .open
= modules_open
,
419 .release
= seq_release
,
423 #ifdef CONFIG_SLABINFO
424 static int slabinfo_open(struct inode
*inode
, struct file
*file
)
426 return seq_open(file
, &slabinfo_op
);
428 static const struct file_operations proc_slabinfo_operations
= {
429 .open
= slabinfo_open
,
431 .write
= slabinfo_write
,
433 .release
= seq_release
,
436 #ifdef CONFIG_DEBUG_SLAB_LEAK
437 extern const struct seq_operations slabstats_op
;
438 static int slabstats_open(struct inode
*inode
, struct file
*file
)
440 unsigned long *n
= kzalloc(PAGE_SIZE
, GFP_KERNEL
);
443 ret
= seq_open(file
, &slabstats_op
);
445 struct seq_file
*m
= file
->private_data
;
446 *n
= PAGE_SIZE
/ (2 * sizeof(unsigned long));
455 static const struct file_operations proc_slabstats_operations
= {
456 .open
= slabstats_open
,
459 .release
= seq_release_private
,
465 static int vmalloc_open(struct inode
*inode
, struct file
*file
)
467 unsigned int *ptr
= NULL
;
471 ptr
= kmalloc(nr_node_ids
* sizeof(unsigned int), GFP_KERNEL
);
472 ret
= seq_open(file
, &vmalloc_op
);
474 struct seq_file
*m
= file
->private_data
;
481 static const struct file_operations proc_vmalloc_operations
= {
482 .open
= vmalloc_open
,
485 .release
= seq_release_private
,
489 #ifndef arch_irq_stat_cpu
490 #define arch_irq_stat_cpu(cpu) 0
492 #ifndef arch_irq_stat
493 #define arch_irq_stat() 0
496 static int show_stat(struct seq_file
*p
, void *v
)
500 cputime64_t user
, nice
, system
, idle
, iowait
, irq
, softirq
, steal
;
503 struct timespec boottime
;
504 unsigned int *per_irq_sum
;
506 per_irq_sum
= kzalloc(sizeof(unsigned int)*NR_IRQS
, GFP_KERNEL
);
510 user
= nice
= system
= idle
= iowait
=
511 irq
= softirq
= steal
= cputime64_zero
;
512 guest
= cputime64_zero
;
513 getboottime(&boottime
);
514 jif
= boottime
.tv_sec
;
516 for_each_possible_cpu(i
) {
519 user
= cputime64_add(user
, kstat_cpu(i
).cpustat
.user
);
520 nice
= cputime64_add(nice
, kstat_cpu(i
).cpustat
.nice
);
521 system
= cputime64_add(system
, kstat_cpu(i
).cpustat
.system
);
522 idle
= cputime64_add(idle
, kstat_cpu(i
).cpustat
.idle
);
523 iowait
= cputime64_add(iowait
, kstat_cpu(i
).cpustat
.iowait
);
524 irq
= cputime64_add(irq
, kstat_cpu(i
).cpustat
.irq
);
525 softirq
= cputime64_add(softirq
, kstat_cpu(i
).cpustat
.softirq
);
526 steal
= cputime64_add(steal
, kstat_cpu(i
).cpustat
.steal
);
527 guest
= cputime64_add(guest
, kstat_cpu(i
).cpustat
.guest
);
528 for (j
= 0; j
< NR_IRQS
; j
++) {
529 unsigned int temp
= kstat_cpu(i
).irqs
[j
];
531 per_irq_sum
[j
] += temp
;
533 sum
+= arch_irq_stat_cpu(i
);
535 sum
+= arch_irq_stat();
537 seq_printf(p
, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
538 (unsigned long long)cputime64_to_clock_t(user
),
539 (unsigned long long)cputime64_to_clock_t(nice
),
540 (unsigned long long)cputime64_to_clock_t(system
),
541 (unsigned long long)cputime64_to_clock_t(idle
),
542 (unsigned long long)cputime64_to_clock_t(iowait
),
543 (unsigned long long)cputime64_to_clock_t(irq
),
544 (unsigned long long)cputime64_to_clock_t(softirq
),
545 (unsigned long long)cputime64_to_clock_t(steal
),
546 (unsigned long long)cputime64_to_clock_t(guest
));
547 for_each_online_cpu(i
) {
549 /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
550 user
= kstat_cpu(i
).cpustat
.user
;
551 nice
= kstat_cpu(i
).cpustat
.nice
;
552 system
= kstat_cpu(i
).cpustat
.system
;
553 idle
= kstat_cpu(i
).cpustat
.idle
;
554 iowait
= kstat_cpu(i
).cpustat
.iowait
;
555 irq
= kstat_cpu(i
).cpustat
.irq
;
556 softirq
= kstat_cpu(i
).cpustat
.softirq
;
557 steal
= kstat_cpu(i
).cpustat
.steal
;
558 guest
= kstat_cpu(i
).cpustat
.guest
;
560 "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
562 (unsigned long long)cputime64_to_clock_t(user
),
563 (unsigned long long)cputime64_to_clock_t(nice
),
564 (unsigned long long)cputime64_to_clock_t(system
),
565 (unsigned long long)cputime64_to_clock_t(idle
),
566 (unsigned long long)cputime64_to_clock_t(iowait
),
567 (unsigned long long)cputime64_to_clock_t(irq
),
568 (unsigned long long)cputime64_to_clock_t(softirq
),
569 (unsigned long long)cputime64_to_clock_t(steal
),
570 (unsigned long long)cputime64_to_clock_t(guest
));
572 seq_printf(p
, "intr %llu", (unsigned long long)sum
);
574 for (i
= 0; i
< NR_IRQS
; i
++)
575 seq_printf(p
, " %u", per_irq_sum
[i
]);
581 "procs_running %lu\n"
582 "procs_blocked %lu\n",
583 nr_context_switches(),
593 static int stat_open(struct inode
*inode
, struct file
*file
)
595 unsigned size
= 4096 * (1 + num_possible_cpus() / 32);
600 /* don't ask for more than the kmalloc() max size, currently 128 KB */
601 if (size
> 128 * 1024)
603 buf
= kmalloc(size
, GFP_KERNEL
);
607 res
= single_open(file
, show_stat
, NULL
);
609 m
= file
->private_data
;
616 static const struct file_operations proc_stat_operations
= {
620 .release
= single_release
,
626 static void *int_seq_start(struct seq_file
*f
, loff_t
*pos
)
628 return (*pos
<= NR_IRQS
) ? pos
: NULL
;
631 static void *int_seq_next(struct seq_file
*f
, void *v
, loff_t
*pos
)
639 static void int_seq_stop(struct seq_file
*f
, void *v
)
645 static const struct seq_operations int_seq_ops
= {
646 .start
= int_seq_start
,
647 .next
= int_seq_next
,
648 .stop
= int_seq_stop
,
649 .show
= show_interrupts
652 static int interrupts_open(struct inode
*inode
, struct file
*filp
)
654 return seq_open(filp
, &int_seq_ops
);
657 static const struct file_operations proc_interrupts_operations
= {
658 .open
= interrupts_open
,
661 .release
= seq_release
,
664 static int filesystems_read_proc(char *page
, char **start
, off_t off
,
665 int count
, int *eof
, void *data
)
667 int len
= get_filesystem_list(page
);
668 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
671 static int cmdline_read_proc(char *page
, char **start
, off_t off
,
672 int count
, int *eof
, void *data
)
676 len
= sprintf(page
, "%s\n", saved_command_line
);
677 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
680 static int locks_open(struct inode
*inode
, struct file
*filp
)
682 return seq_open(filp
, &locks_seq_operations
);
685 static const struct file_operations proc_locks_operations
= {
689 .release
= seq_release
,
692 static int execdomains_read_proc(char *page
, char **start
, off_t off
,
693 int count
, int *eof
, void *data
)
695 int len
= get_exec_domain_list(page
);
696 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
699 #ifdef CONFIG_MAGIC_SYSRQ
701 * writing 'C' to /proc/sysrq-trigger is like sysrq-C
703 static ssize_t
write_sysrq_trigger(struct file
*file
, const char __user
*buf
,
704 size_t count
, loff_t
*ppos
)
709 if (get_user(c
, buf
))
711 __handle_sysrq(c
, NULL
, 0);
716 static const struct file_operations proc_sysrq_trigger_operations
= {
717 .write
= write_sysrq_trigger
,
721 #ifdef CONFIG_PROC_PAGE_MONITOR
722 #define KPMSIZE sizeof(u64)
723 #define KPMMASK (KPMSIZE - 1)
724 /* /proc/kpagecount - an array exposing page counts
726 * Each entry is a u64 representing the corresponding
727 * physical page count.
729 static ssize_t
kpagecount_read(struct file
*file
, char __user
*buf
,
730 size_t count
, loff_t
*ppos
)
732 u64 __user
*out
= (u64 __user
*)buf
;
734 unsigned long src
= *ppos
;
740 count
= min_t(size_t, count
, (max_pfn
* KPMSIZE
) - src
);
741 if (src
& KPMMASK
|| count
& KPMMASK
)
747 ppage
= pfn_to_page(pfn
);
752 pcount
= page_mapcount(ppage
);
754 if (put_user(pcount
, out
++)) {
762 *ppos
+= (char __user
*)out
- buf
;
764 ret
= (char __user
*)out
- buf
;
768 static struct file_operations proc_kpagecount_operations
= {
770 .read
= kpagecount_read
,
773 /* /proc/kpageflags - an array exposing page flags
775 * Each entry is a u64 representing the corresponding
776 * physical page flags.
779 /* These macros are used to decouple internal flags from exported ones */
783 #define KPF_REFERENCED 2
784 #define KPF_UPTODATE 3
789 #define KPF_WRITEBACK 8
790 #define KPF_RECLAIM 9
793 #define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
795 static ssize_t
kpageflags_read(struct file
*file
, char __user
*buf
,
796 size_t count
, loff_t
*ppos
)
798 u64 __user
*out
= (u64 __user
*)buf
;
800 unsigned long src
= *ppos
;
806 count
= min_t(unsigned long, count
, (max_pfn
* KPMSIZE
) - src
);
807 if (src
& KPMMASK
|| count
& KPMMASK
)
813 ppage
= pfn_to_page(pfn
);
818 kflags
= ppage
->flags
;
820 uflags
= kpf_copy_bit(KPF_LOCKED
, PG_locked
, kflags
) |
821 kpf_copy_bit(kflags
, KPF_ERROR
, PG_error
) |
822 kpf_copy_bit(kflags
, KPF_REFERENCED
, PG_referenced
) |
823 kpf_copy_bit(kflags
, KPF_UPTODATE
, PG_uptodate
) |
824 kpf_copy_bit(kflags
, KPF_DIRTY
, PG_dirty
) |
825 kpf_copy_bit(kflags
, KPF_LRU
, PG_lru
) |
826 kpf_copy_bit(kflags
, KPF_ACTIVE
, PG_active
) |
827 kpf_copy_bit(kflags
, KPF_SLAB
, PG_slab
) |
828 kpf_copy_bit(kflags
, KPF_WRITEBACK
, PG_writeback
) |
829 kpf_copy_bit(kflags
, KPF_RECLAIM
, PG_reclaim
) |
830 kpf_copy_bit(kflags
, KPF_BUDDY
, PG_buddy
);
832 if (put_user(uflags
, out
++)) {
840 *ppos
+= (char __user
*)out
- buf
;
842 ret
= (char __user
*)out
- buf
;
846 static struct file_operations proc_kpageflags_operations
= {
848 .read
= kpageflags_read
,
850 #endif /* CONFIG_PROC_PAGE_MONITOR */
852 struct proc_dir_entry
*proc_root_kcore
;
854 void __init
proc_misc_init(void)
858 int (*read_proc
)(char*,char**,off_t
,int,int*,void*);
859 } *p
, simple_ones
[] = {
860 {"loadavg", loadavg_read_proc
},
861 {"uptime", uptime_read_proc
},
862 {"meminfo", meminfo_read_proc
},
863 {"version", version_read_proc
},
864 #ifdef CONFIG_PROC_HARDWARE
865 {"hardware", hardware_read_proc
},
867 #ifdef CONFIG_STRAM_PROC
868 {"stram", stram_read_proc
},
870 {"filesystems", filesystems_read_proc
},
871 {"cmdline", cmdline_read_proc
},
872 {"execdomains", execdomains_read_proc
},
875 for (p
= simple_ones
; p
->name
; p
++)
876 create_proc_read_entry(p
->name
, 0, NULL
, p
->read_proc
, NULL
);
878 proc_symlink("mounts", NULL
, "self/mounts");
880 /* And now for trickier ones */
882 proc_create("kmsg", S_IRUSR
, NULL
, &proc_kmsg_operations
);
884 proc_create("locks", 0, NULL
, &proc_locks_operations
);
885 proc_create("devices", 0, NULL
, &proc_devinfo_operations
);
886 proc_create("cpuinfo", 0, NULL
, &proc_cpuinfo_operations
);
888 proc_create("partitions", 0, NULL
, &proc_partitions_operations
);
890 proc_create("stat", 0, NULL
, &proc_stat_operations
);
891 proc_create("interrupts", 0, NULL
, &proc_interrupts_operations
);
892 #ifdef CONFIG_SLABINFO
893 proc_create("slabinfo",S_IWUSR
|S_IRUGO
,NULL
,&proc_slabinfo_operations
);
894 #ifdef CONFIG_DEBUG_SLAB_LEAK
895 proc_create("slab_allocators", 0, NULL
, &proc_slabstats_operations
);
899 proc_create("vmallocinfo", S_IRUSR
, NULL
, &proc_vmalloc_operations
);
901 proc_create("buddyinfo", S_IRUGO
, NULL
, &fragmentation_file_operations
);
902 proc_create("pagetypeinfo", S_IRUGO
, NULL
, &pagetypeinfo_file_ops
);
903 proc_create("vmstat", S_IRUGO
, NULL
, &proc_vmstat_file_operations
);
904 proc_create("zoneinfo", S_IRUGO
, NULL
, &proc_zoneinfo_file_operations
);
906 proc_create("diskstats", 0, NULL
, &proc_diskstats_operations
);
908 #ifdef CONFIG_MODULES
909 proc_create("modules", 0, NULL
, &proc_modules_operations
);
911 #ifdef CONFIG_SCHEDSTATS
912 proc_create("schedstat", 0, NULL
, &proc_schedstat_operations
);
914 #ifdef CONFIG_PROC_KCORE
915 proc_root_kcore
= proc_create("kcore", S_IRUSR
, NULL
, &proc_kcore_operations
);
917 proc_root_kcore
->size
=
918 (size_t)high_memory
- PAGE_OFFSET
+ PAGE_SIZE
;
920 #ifdef CONFIG_PROC_PAGE_MONITOR
921 proc_create("kpagecount", S_IRUSR
, NULL
, &proc_kpagecount_operations
);
922 proc_create("kpageflags", S_IRUSR
, NULL
, &proc_kpageflags_operations
);
924 #ifdef CONFIG_PROC_VMCORE
925 proc_vmcore
= proc_create("vmcore", S_IRUSR
, NULL
, &proc_vmcore_operations
);
927 #ifdef CONFIG_MAGIC_SYSRQ
928 proc_create("sysrq-trigger", S_IWUSR
, NULL
, &proc_sysrq_trigger_operations
);