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/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 *);
71 static int proc_calc_metrics(char *page
, char **start
, off_t off
,
72 int count
, int *eof
, int len
)
74 if (len
<= off
+count
) *eof
= 1;
77 if (len
>count
) len
= count
;
82 static int loadavg_read_proc(char *page
, char **start
, off_t off
,
83 int count
, int *eof
, void *data
)
90 seq
= read_seqbegin(&xtime_lock
);
91 a
= avenrun
[0] + (FIXED_1
/200);
92 b
= avenrun
[1] + (FIXED_1
/200);
93 c
= avenrun
[2] + (FIXED_1
/200);
94 } while (read_seqretry(&xtime_lock
, seq
));
96 len
= sprintf(page
,"%d.%02d %d.%02d %d.%02d %ld/%d %d\n",
97 LOAD_INT(a
), LOAD_FRAC(a
),
98 LOAD_INT(b
), LOAD_FRAC(b
),
99 LOAD_INT(c
), LOAD_FRAC(c
),
100 nr_running(), nr_threads
,
101 task_active_pid_ns(current
)->last_pid
);
102 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
105 static int uptime_read_proc(char *page
, char **start
, off_t off
,
106 int count
, int *eof
, void *data
)
108 struct timespec uptime
;
109 struct timespec idle
;
111 cputime_t idletime
= cputime_add(init_task
.utime
, init_task
.stime
);
113 do_posix_clock_monotonic_gettime(&uptime
);
114 monotonic_to_bootbased(&uptime
);
115 cputime_to_timespec(idletime
, &idle
);
116 len
= sprintf(page
,"%lu.%02lu %lu.%02lu\n",
117 (unsigned long) uptime
.tv_sec
,
118 (uptime
.tv_nsec
/ (NSEC_PER_SEC
/ 100)),
119 (unsigned long) idle
.tv_sec
,
120 (idle
.tv_nsec
/ (NSEC_PER_SEC
/ 100)));
122 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
125 int __attribute__((weak
)) arch_report_meminfo(char *page
)
130 static int meminfo_read_proc(char *page
, char **start
, off_t off
,
131 int count
, int *eof
, void *data
)
135 unsigned long committed
;
136 unsigned long allowed
;
137 struct vmalloc_info vmi
;
139 unsigned long pages
[NR_LRU_LISTS
];
143 * display in kilobytes.
145 #define K(x) ((x) << (PAGE_SHIFT - 10))
148 committed
= atomic_long_read(&vm_committed_space
);
149 allowed
= ((totalram_pages
- hugetlb_total_pages())
150 * sysctl_overcommit_ratio
/ 100) + total_swap_pages
;
152 cached
= global_page_state(NR_FILE_PAGES
) -
153 total_swapcache_pages
- i
.bufferram
;
157 get_vmalloc_info(&vmi
);
159 for (lru
= LRU_BASE
; lru
< NR_LRU_LISTS
; lru
++)
160 pages
[lru
] = global_page_state(NR_LRU_BASE
+ lru
);
163 * Tagged format, for easy grepping and expansion.
166 "MemTotal: %8lu kB\n"
170 "SwapCached: %8lu kB\n"
172 "Inactive: %8lu kB\n"
173 "Active(anon): %8lu kB\n"
174 "Inactive(anon): %8lu kB\n"
175 "Active(file): %8lu kB\n"
176 "Inactive(file): %8lu kB\n"
177 #ifdef CONFIG_HIGHMEM
178 "HighTotal: %8lu kB\n"
179 "HighFree: %8lu kB\n"
180 "LowTotal: %8lu kB\n"
183 "SwapTotal: %8lu kB\n"
184 "SwapFree: %8lu kB\n"
186 "Writeback: %8lu kB\n"
187 "AnonPages: %8lu kB\n"
190 "SReclaimable: %8lu kB\n"
191 "SUnreclaim: %8lu kB\n"
192 "PageTables: %8lu kB\n"
193 #ifdef CONFIG_QUICKLIST
194 "Quicklists: %8lu kB\n"
196 "NFS_Unstable: %8lu kB\n"
198 "WritebackTmp: %8lu kB\n"
199 "CommitLimit: %8lu kB\n"
200 "Committed_AS: %8lu kB\n"
201 "VmallocTotal: %8lu kB\n"
202 "VmallocUsed: %8lu kB\n"
203 "VmallocChunk: %8lu kB\n",
208 K(total_swapcache_pages
),
209 K(pages
[LRU_ACTIVE_ANON
] + pages
[LRU_ACTIVE_FILE
]),
210 K(pages
[LRU_INACTIVE_ANON
] + pages
[LRU_INACTIVE_FILE
]),
211 K(pages
[LRU_ACTIVE_ANON
]),
212 K(pages
[LRU_INACTIVE_ANON
]),
213 K(pages
[LRU_ACTIVE_FILE
]),
214 K(pages
[LRU_INACTIVE_FILE
]),
215 #ifdef CONFIG_HIGHMEM
218 K(i
.totalram
-i
.totalhigh
),
219 K(i
.freeram
-i
.freehigh
),
223 K(global_page_state(NR_FILE_DIRTY
)),
224 K(global_page_state(NR_WRITEBACK
)),
225 K(global_page_state(NR_ANON_PAGES
)),
226 K(global_page_state(NR_FILE_MAPPED
)),
227 K(global_page_state(NR_SLAB_RECLAIMABLE
) +
228 global_page_state(NR_SLAB_UNRECLAIMABLE
)),
229 K(global_page_state(NR_SLAB_RECLAIMABLE
)),
230 K(global_page_state(NR_SLAB_UNRECLAIMABLE
)),
231 K(global_page_state(NR_PAGETABLE
)),
232 #ifdef CONFIG_QUICKLIST
233 K(quicklist_total_size()),
235 K(global_page_state(NR_UNSTABLE_NFS
)),
236 K(global_page_state(NR_BOUNCE
)),
237 K(global_page_state(NR_WRITEBACK_TEMP
)),
240 (unsigned long)VMALLOC_TOTAL
>> 10,
242 vmi
.largest_chunk
>> 10
245 len
+= hugetlb_report_meminfo(page
+ len
);
247 len
+= arch_report_meminfo(page
+ len
);
249 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
253 static int fragmentation_open(struct inode
*inode
, struct file
*file
)
256 return seq_open(file
, &fragmentation_op
);
259 static const struct file_operations fragmentation_file_operations
= {
260 .open
= fragmentation_open
,
263 .release
= seq_release
,
266 static int pagetypeinfo_open(struct inode
*inode
, struct file
*file
)
268 return seq_open(file
, &pagetypeinfo_op
);
271 static const struct file_operations pagetypeinfo_file_ops
= {
272 .open
= pagetypeinfo_open
,
275 .release
= seq_release
,
278 static int zoneinfo_open(struct inode
*inode
, struct file
*file
)
280 return seq_open(file
, &zoneinfo_op
);
283 static const struct file_operations proc_zoneinfo_file_operations
= {
284 .open
= zoneinfo_open
,
287 .release
= seq_release
,
290 static int version_read_proc(char *page
, char **start
, off_t off
,
291 int count
, int *eof
, void *data
)
295 len
= snprintf(page
, PAGE_SIZE
, linux_proc_banner
,
299 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
302 extern const struct seq_operations cpuinfo_op
;
303 static int cpuinfo_open(struct inode
*inode
, struct file
*file
)
305 return seq_open(file
, &cpuinfo_op
);
308 static const struct file_operations proc_cpuinfo_operations
= {
309 .open
= cpuinfo_open
,
312 .release
= seq_release
,
315 static int devinfo_show(struct seq_file
*f
, void *v
)
317 int i
= *(loff_t
*) v
;
319 if (i
< CHRDEV_MAJOR_HASH_SIZE
) {
321 seq_printf(f
, "Character devices:\n");
326 i
-= CHRDEV_MAJOR_HASH_SIZE
;
328 seq_printf(f
, "\nBlock devices:\n");
335 static void *devinfo_start(struct seq_file
*f
, loff_t
*pos
)
337 if (*pos
< (BLKDEV_MAJOR_HASH_SIZE
+ CHRDEV_MAJOR_HASH_SIZE
))
342 static void *devinfo_next(struct seq_file
*f
, void *v
, loff_t
*pos
)
345 if (*pos
>= (BLKDEV_MAJOR_HASH_SIZE
+ CHRDEV_MAJOR_HASH_SIZE
))
350 static void devinfo_stop(struct seq_file
*f
, void *v
)
355 static const struct seq_operations devinfo_ops
= {
356 .start
= devinfo_start
,
357 .next
= devinfo_next
,
358 .stop
= devinfo_stop
,
362 static int devinfo_open(struct inode
*inode
, struct file
*filp
)
364 return seq_open(filp
, &devinfo_ops
);
367 static const struct file_operations proc_devinfo_operations
= {
368 .open
= devinfo_open
,
371 .release
= seq_release
,
374 static int vmstat_open(struct inode
*inode
, struct file
*file
)
376 return seq_open(file
, &vmstat_op
);
378 static const struct file_operations proc_vmstat_file_operations
= {
382 .release
= seq_release
,
385 #ifdef CONFIG_PROC_HARDWARE
386 static int hardware_read_proc(char *page
, char **start
, off_t off
,
387 int count
, int *eof
, void *data
)
389 int len
= get_hardware_list(page
);
390 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
394 #ifdef CONFIG_STRAM_PROC
395 static int stram_read_proc(char *page
, char **start
, off_t off
,
396 int count
, int *eof
, void *data
)
398 int len
= get_stram_list(page
);
399 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
404 static int partitions_open(struct inode
*inode
, struct file
*file
)
406 return seq_open(file
, &partitions_op
);
408 static const struct file_operations proc_partitions_operations
= {
409 .open
= partitions_open
,
412 .release
= seq_release
,
415 static int diskstats_open(struct inode
*inode
, struct file
*file
)
417 return seq_open(file
, &diskstats_op
);
419 static const struct file_operations proc_diskstats_operations
= {
420 .open
= diskstats_open
,
423 .release
= seq_release
,
427 #ifdef CONFIG_MODULES
428 extern const struct seq_operations modules_op
;
429 static int modules_open(struct inode
*inode
, struct file
*file
)
431 return seq_open(file
, &modules_op
);
433 static const struct file_operations proc_modules_operations
= {
434 .open
= modules_open
,
437 .release
= seq_release
,
441 #ifdef CONFIG_SLABINFO
442 static int slabinfo_open(struct inode
*inode
, struct file
*file
)
444 return seq_open(file
, &slabinfo_op
);
446 static const struct file_operations proc_slabinfo_operations
= {
447 .open
= slabinfo_open
,
449 .write
= slabinfo_write
,
451 .release
= seq_release
,
454 #ifdef CONFIG_DEBUG_SLAB_LEAK
455 extern const struct seq_operations slabstats_op
;
456 static int slabstats_open(struct inode
*inode
, struct file
*file
)
458 unsigned long *n
= kzalloc(PAGE_SIZE
, GFP_KERNEL
);
461 ret
= seq_open(file
, &slabstats_op
);
463 struct seq_file
*m
= file
->private_data
;
464 *n
= PAGE_SIZE
/ (2 * sizeof(unsigned long));
473 static const struct file_operations proc_slabstats_operations
= {
474 .open
= slabstats_open
,
477 .release
= seq_release_private
,
483 static int vmalloc_open(struct inode
*inode
, struct file
*file
)
485 unsigned int *ptr
= NULL
;
489 ptr
= kmalloc(nr_node_ids
* sizeof(unsigned int), GFP_KERNEL
);
490 ret
= seq_open(file
, &vmalloc_op
);
492 struct seq_file
*m
= file
->private_data
;
499 static const struct file_operations proc_vmalloc_operations
= {
500 .open
= vmalloc_open
,
503 .release
= seq_release_private
,
507 #ifndef arch_irq_stat_cpu
508 #define arch_irq_stat_cpu(cpu) 0
510 #ifndef arch_irq_stat
511 #define arch_irq_stat() 0
514 static int show_stat(struct seq_file
*p
, void *v
)
518 cputime64_t user
, nice
, system
, idle
, iowait
, irq
, softirq
, steal
;
521 struct timespec boottime
;
522 unsigned int *per_irq_sum
;
524 per_irq_sum
= kzalloc(sizeof(unsigned int)*NR_IRQS
, GFP_KERNEL
);
528 user
= nice
= system
= idle
= iowait
=
529 irq
= softirq
= steal
= cputime64_zero
;
530 guest
= cputime64_zero
;
531 getboottime(&boottime
);
532 jif
= boottime
.tv_sec
;
534 for_each_possible_cpu(i
) {
537 user
= cputime64_add(user
, kstat_cpu(i
).cpustat
.user
);
538 nice
= cputime64_add(nice
, kstat_cpu(i
).cpustat
.nice
);
539 system
= cputime64_add(system
, kstat_cpu(i
).cpustat
.system
);
540 idle
= cputime64_add(idle
, kstat_cpu(i
).cpustat
.idle
);
541 iowait
= cputime64_add(iowait
, kstat_cpu(i
).cpustat
.iowait
);
542 irq
= cputime64_add(irq
, kstat_cpu(i
).cpustat
.irq
);
543 softirq
= cputime64_add(softirq
, kstat_cpu(i
).cpustat
.softirq
);
544 steal
= cputime64_add(steal
, kstat_cpu(i
).cpustat
.steal
);
545 guest
= cputime64_add(guest
, kstat_cpu(i
).cpustat
.guest
);
546 for (j
= 0; j
< NR_IRQS
; j
++) {
547 unsigned int temp
= kstat_cpu(i
).irqs
[j
];
549 per_irq_sum
[j
] += temp
;
551 sum
+= arch_irq_stat_cpu(i
);
553 sum
+= arch_irq_stat();
555 seq_printf(p
, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
556 (unsigned long long)cputime64_to_clock_t(user
),
557 (unsigned long long)cputime64_to_clock_t(nice
),
558 (unsigned long long)cputime64_to_clock_t(system
),
559 (unsigned long long)cputime64_to_clock_t(idle
),
560 (unsigned long long)cputime64_to_clock_t(iowait
),
561 (unsigned long long)cputime64_to_clock_t(irq
),
562 (unsigned long long)cputime64_to_clock_t(softirq
),
563 (unsigned long long)cputime64_to_clock_t(steal
),
564 (unsigned long long)cputime64_to_clock_t(guest
));
565 for_each_online_cpu(i
) {
567 /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
568 user
= kstat_cpu(i
).cpustat
.user
;
569 nice
= kstat_cpu(i
).cpustat
.nice
;
570 system
= kstat_cpu(i
).cpustat
.system
;
571 idle
= kstat_cpu(i
).cpustat
.idle
;
572 iowait
= kstat_cpu(i
).cpustat
.iowait
;
573 irq
= kstat_cpu(i
).cpustat
.irq
;
574 softirq
= kstat_cpu(i
).cpustat
.softirq
;
575 steal
= kstat_cpu(i
).cpustat
.steal
;
576 guest
= kstat_cpu(i
).cpustat
.guest
;
578 "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
580 (unsigned long long)cputime64_to_clock_t(user
),
581 (unsigned long long)cputime64_to_clock_t(nice
),
582 (unsigned long long)cputime64_to_clock_t(system
),
583 (unsigned long long)cputime64_to_clock_t(idle
),
584 (unsigned long long)cputime64_to_clock_t(iowait
),
585 (unsigned long long)cputime64_to_clock_t(irq
),
586 (unsigned long long)cputime64_to_clock_t(softirq
),
587 (unsigned long long)cputime64_to_clock_t(steal
),
588 (unsigned long long)cputime64_to_clock_t(guest
));
590 seq_printf(p
, "intr %llu", (unsigned long long)sum
);
592 for (i
= 0; i
< NR_IRQS
; i
++)
593 seq_printf(p
, " %u", per_irq_sum
[i
]);
599 "procs_running %lu\n"
600 "procs_blocked %lu\n",
601 nr_context_switches(),
611 static int stat_open(struct inode
*inode
, struct file
*file
)
613 unsigned size
= 4096 * (1 + num_possible_cpus() / 32);
618 /* don't ask for more than the kmalloc() max size, currently 128 KB */
619 if (size
> 128 * 1024)
621 buf
= kmalloc(size
, GFP_KERNEL
);
625 res
= single_open(file
, show_stat
, NULL
);
627 m
= file
->private_data
;
634 static const struct file_operations proc_stat_operations
= {
638 .release
= single_release
,
644 static void *int_seq_start(struct seq_file
*f
, loff_t
*pos
)
646 return (*pos
<= NR_IRQS
) ? pos
: NULL
;
649 static void *int_seq_next(struct seq_file
*f
, void *v
, loff_t
*pos
)
657 static void int_seq_stop(struct seq_file
*f
, void *v
)
663 static const struct seq_operations int_seq_ops
= {
664 .start
= int_seq_start
,
665 .next
= int_seq_next
,
666 .stop
= int_seq_stop
,
667 .show
= show_interrupts
670 static int interrupts_open(struct inode
*inode
, struct file
*filp
)
672 return seq_open(filp
, &int_seq_ops
);
675 static const struct file_operations proc_interrupts_operations
= {
676 .open
= interrupts_open
,
679 .release
= seq_release
,
682 static int filesystems_read_proc(char *page
, char **start
, off_t off
,
683 int count
, int *eof
, void *data
)
685 int len
= get_filesystem_list(page
);
686 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
689 static int cmdline_read_proc(char *page
, char **start
, off_t off
,
690 int count
, int *eof
, void *data
)
694 len
= sprintf(page
, "%s\n", saved_command_line
);
695 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
698 #ifdef CONFIG_FILE_LOCKING
699 static int locks_open(struct inode
*inode
, struct file
*filp
)
701 return seq_open(filp
, &locks_seq_operations
);
704 static const struct file_operations proc_locks_operations
= {
708 .release
= seq_release
,
710 #endif /* CONFIG_FILE_LOCKING */
712 static int execdomains_read_proc(char *page
, char **start
, off_t off
,
713 int count
, int *eof
, void *data
)
715 int len
= get_exec_domain_list(page
);
716 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
719 #ifdef CONFIG_PROC_PAGE_MONITOR
720 #define KPMSIZE sizeof(u64)
721 #define KPMMASK (KPMSIZE - 1)
722 /* /proc/kpagecount - an array exposing page counts
724 * Each entry is a u64 representing the corresponding
725 * physical page count.
727 static ssize_t
kpagecount_read(struct file
*file
, char __user
*buf
,
728 size_t count
, loff_t
*ppos
)
730 u64 __user
*out
= (u64 __user
*)buf
;
732 unsigned long src
= *ppos
;
738 count
= min_t(size_t, count
, (max_pfn
* KPMSIZE
) - src
);
739 if (src
& KPMMASK
|| count
& KPMMASK
)
745 ppage
= pfn_to_page(pfn
);
750 pcount
= page_mapcount(ppage
);
752 if (put_user(pcount
, out
++)) {
760 *ppos
+= (char __user
*)out
- buf
;
762 ret
= (char __user
*)out
- buf
;
766 static struct file_operations proc_kpagecount_operations
= {
768 .read
= kpagecount_read
,
771 /* /proc/kpageflags - an array exposing page flags
773 * Each entry is a u64 representing the corresponding
774 * physical page flags.
777 /* These macros are used to decouple internal flags from exported ones */
781 #define KPF_REFERENCED 2
782 #define KPF_UPTODATE 3
787 #define KPF_WRITEBACK 8
788 #define KPF_RECLAIM 9
791 #define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
793 static ssize_t
kpageflags_read(struct file
*file
, char __user
*buf
,
794 size_t count
, loff_t
*ppos
)
796 u64 __user
*out
= (u64 __user
*)buf
;
798 unsigned long src
= *ppos
;
804 count
= min_t(unsigned long, count
, (max_pfn
* KPMSIZE
) - src
);
805 if (src
& KPMMASK
|| count
& KPMMASK
)
811 ppage
= pfn_to_page(pfn
);
816 kflags
= ppage
->flags
;
818 uflags
= kpf_copy_bit(KPF_LOCKED
, PG_locked
, kflags
) |
819 kpf_copy_bit(kflags
, KPF_ERROR
, PG_error
) |
820 kpf_copy_bit(kflags
, KPF_REFERENCED
, PG_referenced
) |
821 kpf_copy_bit(kflags
, KPF_UPTODATE
, PG_uptodate
) |
822 kpf_copy_bit(kflags
, KPF_DIRTY
, PG_dirty
) |
823 kpf_copy_bit(kflags
, KPF_LRU
, PG_lru
) |
824 kpf_copy_bit(kflags
, KPF_ACTIVE
, PG_active
) |
825 kpf_copy_bit(kflags
, KPF_SLAB
, PG_slab
) |
826 kpf_copy_bit(kflags
, KPF_WRITEBACK
, PG_writeback
) |
827 kpf_copy_bit(kflags
, KPF_RECLAIM
, PG_reclaim
) |
828 kpf_copy_bit(kflags
, KPF_BUDDY
, PG_buddy
);
830 if (put_user(uflags
, out
++)) {
838 *ppos
+= (char __user
*)out
- buf
;
840 ret
= (char __user
*)out
- buf
;
844 static struct file_operations proc_kpageflags_operations
= {
846 .read
= kpageflags_read
,
848 #endif /* CONFIG_PROC_PAGE_MONITOR */
850 struct proc_dir_entry
*proc_root_kcore
;
852 void __init
proc_misc_init(void)
856 int (*read_proc
)(char*,char**,off_t
,int,int*,void*);
857 } *p
, simple_ones
[] = {
858 {"loadavg", loadavg_read_proc
},
859 {"uptime", uptime_read_proc
},
860 {"meminfo", meminfo_read_proc
},
861 {"version", version_read_proc
},
862 #ifdef CONFIG_PROC_HARDWARE
863 {"hardware", hardware_read_proc
},
865 #ifdef CONFIG_STRAM_PROC
866 {"stram", stram_read_proc
},
868 {"filesystems", filesystems_read_proc
},
869 {"cmdline", cmdline_read_proc
},
870 {"execdomains", execdomains_read_proc
},
873 for (p
= simple_ones
; p
->name
; p
++)
874 create_proc_read_entry(p
->name
, 0, NULL
, p
->read_proc
, NULL
);
876 proc_symlink("mounts", NULL
, "self/mounts");
878 /* And now for trickier ones */
880 proc_create("kmsg", S_IRUSR
, NULL
, &proc_kmsg_operations
);
882 #ifdef CONFIG_FILE_LOCKING
883 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
);