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/quicklist.h>
28 #include <linux/proc_fs.h>
29 #include <linux/ioport.h>
31 #include <linux/mmzone.h>
32 #include <linux/pagemap.h>
33 #include <linux/interrupt.h>
34 #include <linux/swap.h>
35 #include <linux/slab.h>
36 #include <linux/genhd.h>
37 #include <linux/smp.h>
38 #include <linux/signal.h>
39 #include <linux/module.h>
40 #include <linux/init.h>
41 #include <linux/seq_file.h>
42 #include <linux/times.h>
43 #include <linux/profile.h>
44 #include <linux/utsname.h>
45 #include <linux/blkdev.h>
46 #include <linux/hugetlb.h>
47 #include <linux/jiffies.h>
48 #include <linux/sysrq.h>
49 #include <linux/vmalloc.h>
50 #include <linux/crash_dump.h>
51 #include <linux/pid_namespace.h>
52 #include <linux/bootmem.h>
53 #include <asm/uaccess.h>
54 #include <asm/pgtable.h>
57 #include <asm/div64.h>
60 #define LOAD_INT(x) ((x) >> FSHIFT)
61 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
63 * Warning: stuff below (imported functions) assumes that its output will fit
64 * into one page. For some of those functions it may be wrong. Moreover, we
65 * have a way to deal with that gracefully. Right now I used straightforward
66 * wrappers, but this needs further analysis wrt potential overflows.
68 extern int get_hardware_list(char *);
69 extern int get_stram_list(char *);
70 extern int get_exec_domain_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 #ifdef CONFIG_QUICKLIST
186 "Quicklists: %8lu kB\n"
188 "NFS_Unstable: %8lu kB\n"
190 "WritebackTmp: %8lu kB\n"
191 "CommitLimit: %8lu kB\n"
192 "Committed_AS: %8lu kB\n"
193 "VmallocTotal: %8lu kB\n"
194 "VmallocUsed: %8lu kB\n"
195 "VmallocChunk: %8lu kB\n",
200 K(total_swapcache_pages
),
201 K(global_page_state(NR_ACTIVE
)),
202 K(global_page_state(NR_INACTIVE
)),
203 #ifdef CONFIG_HIGHMEM
206 K(i
.totalram
-i
.totalhigh
),
207 K(i
.freeram
-i
.freehigh
),
211 K(global_page_state(NR_FILE_DIRTY
)),
212 K(global_page_state(NR_WRITEBACK
)),
213 K(global_page_state(NR_ANON_PAGES
)),
214 K(global_page_state(NR_FILE_MAPPED
)),
215 K(global_page_state(NR_SLAB_RECLAIMABLE
) +
216 global_page_state(NR_SLAB_UNRECLAIMABLE
)),
217 K(global_page_state(NR_SLAB_RECLAIMABLE
)),
218 K(global_page_state(NR_SLAB_UNRECLAIMABLE
)),
219 K(global_page_state(NR_PAGETABLE
)),
220 #ifdef CONFIG_QUICKLIST
221 K(quicklist_total_size()),
223 K(global_page_state(NR_UNSTABLE_NFS
)),
224 K(global_page_state(NR_BOUNCE
)),
225 K(global_page_state(NR_WRITEBACK_TEMP
)),
228 (unsigned long)VMALLOC_TOTAL
>> 10,
230 vmi
.largest_chunk
>> 10
233 len
+= hugetlb_report_meminfo(page
+ len
);
235 len
+= arch_report_meminfo(page
+ len
);
237 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
241 static int fragmentation_open(struct inode
*inode
, struct file
*file
)
244 return seq_open(file
, &fragmentation_op
);
247 static const struct file_operations fragmentation_file_operations
= {
248 .open
= fragmentation_open
,
251 .release
= seq_release
,
254 static int pagetypeinfo_open(struct inode
*inode
, struct file
*file
)
256 return seq_open(file
, &pagetypeinfo_op
);
259 static const struct file_operations pagetypeinfo_file_ops
= {
260 .open
= pagetypeinfo_open
,
263 .release
= seq_release
,
266 static int zoneinfo_open(struct inode
*inode
, struct file
*file
)
268 return seq_open(file
, &zoneinfo_op
);
271 static const struct file_operations proc_zoneinfo_file_operations
= {
272 .open
= zoneinfo_open
,
275 .release
= seq_release
,
278 static int version_read_proc(char *page
, char **start
, off_t off
,
279 int count
, int *eof
, void *data
)
283 len
= snprintf(page
, PAGE_SIZE
, linux_proc_banner
,
287 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
290 extern const struct seq_operations cpuinfo_op
;
291 static int cpuinfo_open(struct inode
*inode
, struct file
*file
)
293 return seq_open(file
, &cpuinfo_op
);
296 static const struct file_operations proc_cpuinfo_operations
= {
297 .open
= cpuinfo_open
,
300 .release
= seq_release
,
303 static int devinfo_show(struct seq_file
*f
, void *v
)
305 int i
= *(loff_t
*) v
;
307 if (i
< CHRDEV_MAJOR_HASH_SIZE
) {
309 seq_printf(f
, "Character devices:\n");
314 i
-= CHRDEV_MAJOR_HASH_SIZE
;
316 seq_printf(f
, "\nBlock devices:\n");
323 static void *devinfo_start(struct seq_file
*f
, loff_t
*pos
)
325 if (*pos
< (BLKDEV_MAJOR_HASH_SIZE
+ CHRDEV_MAJOR_HASH_SIZE
))
330 static void *devinfo_next(struct seq_file
*f
, void *v
, loff_t
*pos
)
333 if (*pos
>= (BLKDEV_MAJOR_HASH_SIZE
+ CHRDEV_MAJOR_HASH_SIZE
))
338 static void devinfo_stop(struct seq_file
*f
, void *v
)
343 static const struct seq_operations devinfo_ops
= {
344 .start
= devinfo_start
,
345 .next
= devinfo_next
,
346 .stop
= devinfo_stop
,
350 static int devinfo_open(struct inode
*inode
, struct file
*filp
)
352 return seq_open(filp
, &devinfo_ops
);
355 static const struct file_operations proc_devinfo_operations
= {
356 .open
= devinfo_open
,
359 .release
= seq_release
,
362 static int vmstat_open(struct inode
*inode
, struct file
*file
)
364 return seq_open(file
, &vmstat_op
);
366 static const struct file_operations proc_vmstat_file_operations
= {
370 .release
= seq_release
,
373 #ifdef CONFIG_PROC_HARDWARE
374 static int hardware_read_proc(char *page
, char **start
, off_t off
,
375 int count
, int *eof
, void *data
)
377 int len
= get_hardware_list(page
);
378 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
382 #ifdef CONFIG_STRAM_PROC
383 static int stram_read_proc(char *page
, char **start
, off_t off
,
384 int count
, int *eof
, void *data
)
386 int len
= get_stram_list(page
);
387 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
392 static int partitions_open(struct inode
*inode
, struct file
*file
)
394 return seq_open(file
, &partitions_op
);
396 static const struct file_operations proc_partitions_operations
= {
397 .open
= partitions_open
,
400 .release
= seq_release
,
403 static int diskstats_open(struct inode
*inode
, struct file
*file
)
405 return seq_open(file
, &diskstats_op
);
407 static const struct file_operations proc_diskstats_operations
= {
408 .open
= diskstats_open
,
411 .release
= seq_release
,
415 #ifdef CONFIG_MODULES
416 extern const struct seq_operations modules_op
;
417 static int modules_open(struct inode
*inode
, struct file
*file
)
419 return seq_open(file
, &modules_op
);
421 static const struct file_operations proc_modules_operations
= {
422 .open
= modules_open
,
425 .release
= seq_release
,
429 #ifdef CONFIG_SLABINFO
430 static int slabinfo_open(struct inode
*inode
, struct file
*file
)
432 return seq_open(file
, &slabinfo_op
);
434 static const struct file_operations proc_slabinfo_operations
= {
435 .open
= slabinfo_open
,
437 .write
= slabinfo_write
,
439 .release
= seq_release
,
442 #ifdef CONFIG_DEBUG_SLAB_LEAK
443 extern const struct seq_operations slabstats_op
;
444 static int slabstats_open(struct inode
*inode
, struct file
*file
)
446 unsigned long *n
= kzalloc(PAGE_SIZE
, GFP_KERNEL
);
449 ret
= seq_open(file
, &slabstats_op
);
451 struct seq_file
*m
= file
->private_data
;
452 *n
= PAGE_SIZE
/ (2 * sizeof(unsigned long));
461 static const struct file_operations proc_slabstats_operations
= {
462 .open
= slabstats_open
,
465 .release
= seq_release_private
,
471 static int vmalloc_open(struct inode
*inode
, struct file
*file
)
473 unsigned int *ptr
= NULL
;
477 ptr
= kmalloc(nr_node_ids
* sizeof(unsigned int), GFP_KERNEL
);
478 ret
= seq_open(file
, &vmalloc_op
);
480 struct seq_file
*m
= file
->private_data
;
487 static const struct file_operations proc_vmalloc_operations
= {
488 .open
= vmalloc_open
,
491 .release
= seq_release_private
,
495 #ifndef arch_irq_stat_cpu
496 #define arch_irq_stat_cpu(cpu) 0
498 #ifndef arch_irq_stat
499 #define arch_irq_stat() 0
502 static int show_stat(struct seq_file
*p
, void *v
)
506 cputime64_t user
, nice
, system
, idle
, iowait
, irq
, softirq
, steal
;
509 struct timespec boottime
;
510 unsigned int *per_irq_sum
;
512 per_irq_sum
= kzalloc(sizeof(unsigned int)*nr_irqs
, GFP_KERNEL
);
516 user
= nice
= system
= idle
= iowait
=
517 irq
= softirq
= steal
= cputime64_zero
;
518 guest
= cputime64_zero
;
519 getboottime(&boottime
);
520 jif
= boottime
.tv_sec
;
522 for_each_possible_cpu(i
) {
525 user
= cputime64_add(user
, kstat_cpu(i
).cpustat
.user
);
526 nice
= cputime64_add(nice
, kstat_cpu(i
).cpustat
.nice
);
527 system
= cputime64_add(system
, kstat_cpu(i
).cpustat
.system
);
528 idle
= cputime64_add(idle
, kstat_cpu(i
).cpustat
.idle
);
529 iowait
= cputime64_add(iowait
, kstat_cpu(i
).cpustat
.iowait
);
530 irq
= cputime64_add(irq
, kstat_cpu(i
).cpustat
.irq
);
531 softirq
= cputime64_add(softirq
, kstat_cpu(i
).cpustat
.softirq
);
532 steal
= cputime64_add(steal
, kstat_cpu(i
).cpustat
.steal
);
533 guest
= cputime64_add(guest
, kstat_cpu(i
).cpustat
.guest
);
534 for (j
= 0; j
< nr_irqs
; j
++) {
535 unsigned int temp
= kstat_cpu(i
).irqs
[j
];
537 per_irq_sum
[j
] += temp
;
539 sum
+= arch_irq_stat_cpu(i
);
541 sum
+= arch_irq_stat();
543 seq_printf(p
, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
544 (unsigned long long)cputime64_to_clock_t(user
),
545 (unsigned long long)cputime64_to_clock_t(nice
),
546 (unsigned long long)cputime64_to_clock_t(system
),
547 (unsigned long long)cputime64_to_clock_t(idle
),
548 (unsigned long long)cputime64_to_clock_t(iowait
),
549 (unsigned long long)cputime64_to_clock_t(irq
),
550 (unsigned long long)cputime64_to_clock_t(softirq
),
551 (unsigned long long)cputime64_to_clock_t(steal
),
552 (unsigned long long)cputime64_to_clock_t(guest
));
553 for_each_online_cpu(i
) {
555 /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
556 user
= kstat_cpu(i
).cpustat
.user
;
557 nice
= kstat_cpu(i
).cpustat
.nice
;
558 system
= kstat_cpu(i
).cpustat
.system
;
559 idle
= kstat_cpu(i
).cpustat
.idle
;
560 iowait
= kstat_cpu(i
).cpustat
.iowait
;
561 irq
= kstat_cpu(i
).cpustat
.irq
;
562 softirq
= kstat_cpu(i
).cpustat
.softirq
;
563 steal
= kstat_cpu(i
).cpustat
.steal
;
564 guest
= kstat_cpu(i
).cpustat
.guest
;
566 "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
568 (unsigned long long)cputime64_to_clock_t(user
),
569 (unsigned long long)cputime64_to_clock_t(nice
),
570 (unsigned long long)cputime64_to_clock_t(system
),
571 (unsigned long long)cputime64_to_clock_t(idle
),
572 (unsigned long long)cputime64_to_clock_t(iowait
),
573 (unsigned long long)cputime64_to_clock_t(irq
),
574 (unsigned long long)cputime64_to_clock_t(softirq
),
575 (unsigned long long)cputime64_to_clock_t(steal
),
576 (unsigned long long)cputime64_to_clock_t(guest
));
578 seq_printf(p
, "intr %llu", (unsigned long long)sum
);
580 for (i
= 0; i
< nr_irqs
; i
++)
581 seq_printf(p
, " %u", per_irq_sum
[i
]);
587 "procs_running %lu\n"
588 "procs_blocked %lu\n",
589 nr_context_switches(),
599 static int stat_open(struct inode
*inode
, struct file
*file
)
601 unsigned size
= 4096 * (1 + num_possible_cpus() / 32);
606 /* don't ask for more than the kmalloc() max size, currently 128 KB */
607 if (size
> 128 * 1024)
609 buf
= kmalloc(size
, GFP_KERNEL
);
613 res
= single_open(file
, show_stat
, NULL
);
615 m
= file
->private_data
;
622 static const struct file_operations proc_stat_operations
= {
626 .release
= single_release
,
632 static void *int_seq_start(struct seq_file
*f
, loff_t
*pos
)
634 return (*pos
<= nr_irqs
) ? pos
: NULL
;
637 static void *int_seq_next(struct seq_file
*f
, void *v
, loff_t
*pos
)
645 static void int_seq_stop(struct seq_file
*f
, void *v
)
651 static const struct seq_operations int_seq_ops
= {
652 .start
= int_seq_start
,
653 .next
= int_seq_next
,
654 .stop
= int_seq_stop
,
655 .show
= show_interrupts
658 static int interrupts_open(struct inode
*inode
, struct file
*filp
)
660 return seq_open(filp
, &int_seq_ops
);
663 static const struct file_operations proc_interrupts_operations
= {
664 .open
= interrupts_open
,
667 .release
= seq_release
,
670 static int filesystems_read_proc(char *page
, char **start
, off_t off
,
671 int count
, int *eof
, void *data
)
673 int len
= get_filesystem_list(page
);
674 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
677 static int cmdline_read_proc(char *page
, char **start
, off_t off
,
678 int count
, int *eof
, void *data
)
682 len
= sprintf(page
, "%s\n", saved_command_line
);
683 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
686 #ifdef CONFIG_FILE_LOCKING
687 static int locks_open(struct inode
*inode
, struct file
*filp
)
689 return seq_open(filp
, &locks_seq_operations
);
692 static const struct file_operations proc_locks_operations
= {
696 .release
= seq_release
,
698 #endif /* CONFIG_FILE_LOCKING */
700 static int execdomains_read_proc(char *page
, char **start
, off_t off
,
701 int count
, int *eof
, void *data
)
703 int len
= get_exec_domain_list(page
);
704 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
707 #ifdef CONFIG_MAGIC_SYSRQ
709 * writing 'C' to /proc/sysrq-trigger is like sysrq-C
711 static ssize_t
write_sysrq_trigger(struct file
*file
, const char __user
*buf
,
712 size_t count
, loff_t
*ppos
)
717 if (get_user(c
, buf
))
719 __handle_sysrq(c
, NULL
, 0);
724 static const struct file_operations proc_sysrq_trigger_operations
= {
725 .write
= write_sysrq_trigger
,
729 #ifdef CONFIG_PROC_PAGE_MONITOR
730 #define KPMSIZE sizeof(u64)
731 #define KPMMASK (KPMSIZE - 1)
732 /* /proc/kpagecount - an array exposing page counts
734 * Each entry is a u64 representing the corresponding
735 * physical page count.
737 static ssize_t
kpagecount_read(struct file
*file
, char __user
*buf
,
738 size_t count
, loff_t
*ppos
)
740 u64 __user
*out
= (u64 __user
*)buf
;
742 unsigned long src
= *ppos
;
748 count
= min_t(size_t, count
, (max_pfn
* KPMSIZE
) - src
);
749 if (src
& KPMMASK
|| count
& KPMMASK
)
755 ppage
= pfn_to_page(pfn
);
760 pcount
= page_mapcount(ppage
);
762 if (put_user(pcount
, out
++)) {
770 *ppos
+= (char __user
*)out
- buf
;
772 ret
= (char __user
*)out
- buf
;
776 static struct file_operations proc_kpagecount_operations
= {
778 .read
= kpagecount_read
,
781 /* /proc/kpageflags - an array exposing page flags
783 * Each entry is a u64 representing the corresponding
784 * physical page flags.
787 /* These macros are used to decouple internal flags from exported ones */
791 #define KPF_REFERENCED 2
792 #define KPF_UPTODATE 3
797 #define KPF_WRITEBACK 8
798 #define KPF_RECLAIM 9
801 #define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
803 static ssize_t
kpageflags_read(struct file
*file
, char __user
*buf
,
804 size_t count
, loff_t
*ppos
)
806 u64 __user
*out
= (u64 __user
*)buf
;
808 unsigned long src
= *ppos
;
814 count
= min_t(unsigned long, count
, (max_pfn
* KPMSIZE
) - src
);
815 if (src
& KPMMASK
|| count
& KPMMASK
)
821 ppage
= pfn_to_page(pfn
);
826 kflags
= ppage
->flags
;
828 uflags
= kpf_copy_bit(KPF_LOCKED
, PG_locked
, kflags
) |
829 kpf_copy_bit(kflags
, KPF_ERROR
, PG_error
) |
830 kpf_copy_bit(kflags
, KPF_REFERENCED
, PG_referenced
) |
831 kpf_copy_bit(kflags
, KPF_UPTODATE
, PG_uptodate
) |
832 kpf_copy_bit(kflags
, KPF_DIRTY
, PG_dirty
) |
833 kpf_copy_bit(kflags
, KPF_LRU
, PG_lru
) |
834 kpf_copy_bit(kflags
, KPF_ACTIVE
, PG_active
) |
835 kpf_copy_bit(kflags
, KPF_SLAB
, PG_slab
) |
836 kpf_copy_bit(kflags
, KPF_WRITEBACK
, PG_writeback
) |
837 kpf_copy_bit(kflags
, KPF_RECLAIM
, PG_reclaim
) |
838 kpf_copy_bit(kflags
, KPF_BUDDY
, PG_buddy
);
840 if (put_user(uflags
, out
++)) {
848 *ppos
+= (char __user
*)out
- buf
;
850 ret
= (char __user
*)out
- buf
;
854 static struct file_operations proc_kpageflags_operations
= {
856 .read
= kpageflags_read
,
858 #endif /* CONFIG_PROC_PAGE_MONITOR */
860 struct proc_dir_entry
*proc_root_kcore
;
862 void __init
proc_misc_init(void)
866 int (*read_proc
)(char*,char**,off_t
,int,int*,void*);
867 } *p
, simple_ones
[] = {
868 {"loadavg", loadavg_read_proc
},
869 {"uptime", uptime_read_proc
},
870 {"meminfo", meminfo_read_proc
},
871 {"version", version_read_proc
},
872 #ifdef CONFIG_PROC_HARDWARE
873 {"hardware", hardware_read_proc
},
875 #ifdef CONFIG_STRAM_PROC
876 {"stram", stram_read_proc
},
878 {"filesystems", filesystems_read_proc
},
879 {"cmdline", cmdline_read_proc
},
880 {"execdomains", execdomains_read_proc
},
883 for (p
= simple_ones
; p
->name
; p
++)
884 create_proc_read_entry(p
->name
, 0, NULL
, p
->read_proc
, NULL
);
886 proc_symlink("mounts", NULL
, "self/mounts");
888 /* And now for trickier ones */
890 proc_create("kmsg", S_IRUSR
, NULL
, &proc_kmsg_operations
);
892 #ifdef CONFIG_FILE_LOCKING
893 proc_create("locks", 0, NULL
, &proc_locks_operations
);
895 proc_create("devices", 0, NULL
, &proc_devinfo_operations
);
896 proc_create("cpuinfo", 0, NULL
, &proc_cpuinfo_operations
);
898 proc_create("partitions", 0, NULL
, &proc_partitions_operations
);
900 proc_create("stat", 0, NULL
, &proc_stat_operations
);
901 proc_create("interrupts", 0, NULL
, &proc_interrupts_operations
);
902 #ifdef CONFIG_SLABINFO
903 proc_create("slabinfo",S_IWUSR
|S_IRUGO
,NULL
,&proc_slabinfo_operations
);
904 #ifdef CONFIG_DEBUG_SLAB_LEAK
905 proc_create("slab_allocators", 0, NULL
, &proc_slabstats_operations
);
909 proc_create("vmallocinfo", S_IRUSR
, NULL
, &proc_vmalloc_operations
);
911 proc_create("buddyinfo", S_IRUGO
, NULL
, &fragmentation_file_operations
);
912 proc_create("pagetypeinfo", S_IRUGO
, NULL
, &pagetypeinfo_file_ops
);
913 proc_create("vmstat", S_IRUGO
, NULL
, &proc_vmstat_file_operations
);
914 proc_create("zoneinfo", S_IRUGO
, NULL
, &proc_zoneinfo_file_operations
);
916 proc_create("diskstats", 0, NULL
, &proc_diskstats_operations
);
918 #ifdef CONFIG_MODULES
919 proc_create("modules", 0, NULL
, &proc_modules_operations
);
921 #ifdef CONFIG_SCHEDSTATS
922 proc_create("schedstat", 0, NULL
, &proc_schedstat_operations
);
924 #ifdef CONFIG_PROC_KCORE
925 proc_root_kcore
= proc_create("kcore", S_IRUSR
, NULL
, &proc_kcore_operations
);
927 proc_root_kcore
->size
=
928 (size_t)high_memory
- PAGE_OFFSET
+ PAGE_SIZE
;
930 #ifdef CONFIG_PROC_PAGE_MONITOR
931 proc_create("kpagecount", S_IRUSR
, NULL
, &proc_kpagecount_operations
);
932 proc_create("kpageflags", S_IRUSR
, NULL
, &proc_kpageflags_operations
);
934 #ifdef CONFIG_PROC_VMCORE
935 proc_vmcore
= proc_create("vmcore", S_IRUSR
, NULL
, &proc_vmcore_operations
);
937 #ifdef CONFIG_MAGIC_SYSRQ
938 proc_create("sysrq-trigger", S_IWUSR
, NULL
, &proc_sysrq_trigger_operations
);