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 <<<<<<< HEAD
:fs
/proc
/proc_misc
.c
37 #include <linux/genhd.h>
38 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:fs
/proc
/proc_misc
.c
39 #include <linux/smp.h>
40 #include <linux/signal.h>
41 #include <linux/module.h>
42 #include <linux/init.h>
43 #include <linux/seq_file.h>
44 #include <linux/times.h>
45 #include <linux/profile.h>
46 #include <linux/utsname.h>
47 #include <linux/blkdev.h>
48 #include <linux/hugetlb.h>
49 #include <linux/jiffies.h>
50 #include <linux/sysrq.h>
51 #include <linux/vmalloc.h>
52 #include <linux/crash_dump.h>
53 #include <linux/pid_namespace.h>
54 #include <linux/bootmem.h>
55 #include <asm/uaccess.h>
56 #include <asm/pgtable.h>
59 #include <asm/div64.h>
62 #define LOAD_INT(x) ((x) >> FSHIFT)
63 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
65 * Warning: stuff below (imported functions) assumes that its output will fit
66 * into one page. For some of those functions it may be wrong. Moreover, we
67 * have a way to deal with that gracefully. Right now I used straightforward
68 * wrappers, but this needs further analysis wrt potential overflows.
70 extern int get_hardware_list(char *);
71 extern int get_stram_list(char *);
72 extern int get_exec_domain_list(char *);
73 extern int get_dma_list(char *);
75 static int proc_calc_metrics(char *page
, char **start
, off_t off
,
76 int count
, int *eof
, int len
)
78 if (len
<= off
+count
) *eof
= 1;
81 if (len
>count
) len
= count
;
86 static int loadavg_read_proc(char *page
, char **start
, off_t off
,
87 int count
, int *eof
, void *data
)
94 seq
= read_seqbegin(&xtime_lock
);
95 a
= avenrun
[0] + (FIXED_1
/200);
96 b
= avenrun
[1] + (FIXED_1
/200);
97 c
= avenrun
[2] + (FIXED_1
/200);
98 } while (read_seqretry(&xtime_lock
, seq
));
100 len
= sprintf(page
,"%d.%02d %d.%02d %d.%02d %ld/%d %d\n",
101 LOAD_INT(a
), LOAD_FRAC(a
),
102 LOAD_INT(b
), LOAD_FRAC(b
),
103 LOAD_INT(c
), LOAD_FRAC(c
),
104 nr_running(), nr_threads
,
105 task_active_pid_ns(current
)->last_pid
);
106 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
109 static int uptime_read_proc(char *page
, char **start
, off_t off
,
110 int count
, int *eof
, void *data
)
112 struct timespec uptime
;
113 struct timespec idle
;
115 cputime_t idletime
= cputime_add(init_task
.utime
, init_task
.stime
);
117 do_posix_clock_monotonic_gettime(&uptime
);
118 monotonic_to_bootbased(&uptime
);
119 cputime_to_timespec(idletime
, &idle
);
120 len
= sprintf(page
,"%lu.%02lu %lu.%02lu\n",
121 (unsigned long) uptime
.tv_sec
,
122 (uptime
.tv_nsec
/ (NSEC_PER_SEC
/ 100)),
123 (unsigned long) idle
.tv_sec
,
124 (idle
.tv_nsec
/ (NSEC_PER_SEC
/ 100)));
126 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
129 static int meminfo_read_proc(char *page
, char **start
, off_t off
,
130 int count
, int *eof
, void *data
)
134 unsigned long committed
;
135 unsigned long allowed
;
136 struct vmalloc_info vmi
;
140 * display in kilobytes.
142 #define K(x) ((x) << (PAGE_SHIFT - 10))
145 committed
= atomic_read(&vm_committed_space
);
146 allowed
= ((totalram_pages
- hugetlb_total_pages())
147 * sysctl_overcommit_ratio
/ 100) + total_swap_pages
;
149 cached
= global_page_state(NR_FILE_PAGES
) -
150 total_swapcache_pages
- i
.bufferram
;
154 get_vmalloc_info(&vmi
);
157 * Tagged format, for easy grepping and expansion.
160 "MemTotal: %8lu kB\n"
164 "SwapCached: %8lu kB\n"
166 "Inactive: %8lu kB\n"
167 #ifdef CONFIG_HIGHMEM
168 "HighTotal: %8lu kB\n"
169 "HighFree: %8lu kB\n"
170 "LowTotal: %8lu kB\n"
173 "SwapTotal: %8lu kB\n"
174 "SwapFree: %8lu kB\n"
176 "Writeback: %8lu kB\n"
177 "AnonPages: %8lu kB\n"
180 "SReclaimable: %8lu kB\n"
181 "SUnreclaim: %8lu kB\n"
182 "PageTables: %8lu kB\n"
183 "NFS_Unstable: %8lu kB\n"
185 "CommitLimit: %8lu kB\n"
186 "Committed_AS: %8lu kB\n"
187 "VmallocTotal: %8lu kB\n"
188 "VmallocUsed: %8lu kB\n"
189 "VmallocChunk: %8lu kB\n",
194 K(total_swapcache_pages
),
195 K(global_page_state(NR_ACTIVE
)),
196 K(global_page_state(NR_INACTIVE
)),
197 #ifdef CONFIG_HIGHMEM
200 K(i
.totalram
-i
.totalhigh
),
201 K(i
.freeram
-i
.freehigh
),
205 K(global_page_state(NR_FILE_DIRTY
)),
206 K(global_page_state(NR_WRITEBACK
)),
207 K(global_page_state(NR_ANON_PAGES
)),
208 K(global_page_state(NR_FILE_MAPPED
)),
209 K(global_page_state(NR_SLAB_RECLAIMABLE
) +
210 global_page_state(NR_SLAB_UNRECLAIMABLE
)),
211 K(global_page_state(NR_SLAB_RECLAIMABLE
)),
212 K(global_page_state(NR_SLAB_UNRECLAIMABLE
)),
213 K(global_page_state(NR_PAGETABLE
)),
214 K(global_page_state(NR_UNSTABLE_NFS
)),
215 K(global_page_state(NR_BOUNCE
)),
218 (unsigned long)VMALLOC_TOTAL
>> 10,
220 vmi
.largest_chunk
>> 10
223 len
+= hugetlb_report_meminfo(page
+ len
);
225 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
229 extern const struct seq_operations fragmentation_op
;
230 static int fragmentation_open(struct inode
*inode
, struct file
*file
)
233 return seq_open(file
, &fragmentation_op
);
236 static const struct file_operations fragmentation_file_operations
= {
237 .open
= fragmentation_open
,
240 .release
= seq_release
,
243 extern const struct seq_operations pagetypeinfo_op
;
244 static int pagetypeinfo_open(struct inode
*inode
, struct file
*file
)
246 return seq_open(file
, &pagetypeinfo_op
);
249 static const struct file_operations pagetypeinfo_file_ops
= {
250 .open
= pagetypeinfo_open
,
253 .release
= seq_release
,
256 extern const struct seq_operations zoneinfo_op
;
257 static int zoneinfo_open(struct inode
*inode
, struct file
*file
)
259 return seq_open(file
, &zoneinfo_op
);
262 static const struct file_operations proc_zoneinfo_file_operations
= {
263 .open
= zoneinfo_open
,
266 .release
= seq_release
,
269 static int version_read_proc(char *page
, char **start
, off_t off
,
270 int count
, int *eof
, void *data
)
274 len
= snprintf(page
, PAGE_SIZE
, linux_proc_banner
,
278 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
281 extern const struct seq_operations cpuinfo_op
;
282 static int cpuinfo_open(struct inode
*inode
, struct file
*file
)
284 return seq_open(file
, &cpuinfo_op
);
287 static const struct file_operations proc_cpuinfo_operations
= {
288 .open
= cpuinfo_open
,
291 .release
= seq_release
,
294 static int devinfo_show(struct seq_file
*f
, void *v
)
296 int i
= *(loff_t
*) v
;
298 if (i
< CHRDEV_MAJOR_HASH_SIZE
) {
300 seq_printf(f
, "Character devices:\n");
305 i
-= CHRDEV_MAJOR_HASH_SIZE
;
307 seq_printf(f
, "\nBlock devices:\n");
314 static void *devinfo_start(struct seq_file
*f
, loff_t
*pos
)
316 if (*pos
< (BLKDEV_MAJOR_HASH_SIZE
+ CHRDEV_MAJOR_HASH_SIZE
))
321 static void *devinfo_next(struct seq_file
*f
, void *v
, loff_t
*pos
)
324 if (*pos
>= (BLKDEV_MAJOR_HASH_SIZE
+ CHRDEV_MAJOR_HASH_SIZE
))
329 static void devinfo_stop(struct seq_file
*f
, void *v
)
334 static const struct seq_operations devinfo_ops
= {
335 .start
= devinfo_start
,
336 .next
= devinfo_next
,
337 .stop
= devinfo_stop
,
341 static int devinfo_open(struct inode
*inode
, struct file
*filp
)
343 return seq_open(filp
, &devinfo_ops
);
346 static const struct file_operations proc_devinfo_operations
= {
347 .open
= devinfo_open
,
350 .release
= seq_release
,
353 extern const struct seq_operations vmstat_op
;
354 static int vmstat_open(struct inode
*inode
, struct file
*file
)
356 return seq_open(file
, &vmstat_op
);
358 static const struct file_operations proc_vmstat_file_operations
= {
362 .release
= seq_release
,
365 #ifdef CONFIG_PROC_HARDWARE
366 static int hardware_read_proc(char *page
, char **start
, off_t off
,
367 int count
, int *eof
, void *data
)
369 int len
= get_hardware_list(page
);
370 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
374 #ifdef CONFIG_STRAM_PROC
375 static int stram_read_proc(char *page
, char **start
, off_t off
,
376 int count
, int *eof
, void *data
)
378 int len
= get_stram_list(page
);
379 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
384 <<<<<<< HEAD
:fs
/proc
/proc_misc
.c
385 extern const struct seq_operations partitions_op
;
387 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:fs
/proc
/proc_misc
.c
388 static int partitions_open(struct inode
*inode
, struct file
*file
)
390 return seq_open(file
, &partitions_op
);
392 static const struct file_operations proc_partitions_operations
= {
393 .open
= partitions_open
,
396 .release
= seq_release
,
399 <<<<<<< HEAD
:fs
/proc
/proc_misc
.c
400 extern const struct seq_operations diskstats_op
;
402 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:fs
/proc
/proc_misc
.c
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
,
470 static int show_stat(struct seq_file
*p
, void *v
)
474 cputime64_t user
, nice
, system
, idle
, iowait
, irq
, softirq
, steal
;
477 struct timespec boottime
;
478 unsigned int *per_irq_sum
;
480 per_irq_sum
= kzalloc(sizeof(unsigned int)*NR_IRQS
, GFP_KERNEL
);
484 user
= nice
= system
= idle
= iowait
=
485 irq
= softirq
= steal
= cputime64_zero
;
486 guest
= cputime64_zero
;
487 getboottime(&boottime
);
488 jif
= boottime
.tv_sec
;
490 for_each_possible_cpu(i
) {
493 user
= cputime64_add(user
, kstat_cpu(i
).cpustat
.user
);
494 nice
= cputime64_add(nice
, kstat_cpu(i
).cpustat
.nice
);
495 system
= cputime64_add(system
, kstat_cpu(i
).cpustat
.system
);
496 idle
= cputime64_add(idle
, kstat_cpu(i
).cpustat
.idle
);
497 iowait
= cputime64_add(iowait
, kstat_cpu(i
).cpustat
.iowait
);
498 irq
= cputime64_add(irq
, kstat_cpu(i
).cpustat
.irq
);
499 softirq
= cputime64_add(softirq
, kstat_cpu(i
).cpustat
.softirq
);
500 steal
= cputime64_add(steal
, kstat_cpu(i
).cpustat
.steal
);
501 guest
= cputime64_add(guest
, kstat_cpu(i
).cpustat
.guest
);
502 for (j
= 0; j
< NR_IRQS
; j
++) {
503 unsigned int temp
= kstat_cpu(i
).irqs
[j
];
505 per_irq_sum
[j
] += temp
;
509 seq_printf(p
, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
510 (unsigned long long)cputime64_to_clock_t(user
),
511 (unsigned long long)cputime64_to_clock_t(nice
),
512 (unsigned long long)cputime64_to_clock_t(system
),
513 (unsigned long long)cputime64_to_clock_t(idle
),
514 (unsigned long long)cputime64_to_clock_t(iowait
),
515 (unsigned long long)cputime64_to_clock_t(irq
),
516 (unsigned long long)cputime64_to_clock_t(softirq
),
517 (unsigned long long)cputime64_to_clock_t(steal
),
518 (unsigned long long)cputime64_to_clock_t(guest
));
519 for_each_online_cpu(i
) {
521 /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
522 user
= kstat_cpu(i
).cpustat
.user
;
523 nice
= kstat_cpu(i
).cpustat
.nice
;
524 system
= kstat_cpu(i
).cpustat
.system
;
525 idle
= kstat_cpu(i
).cpustat
.idle
;
526 iowait
= kstat_cpu(i
).cpustat
.iowait
;
527 irq
= kstat_cpu(i
).cpustat
.irq
;
528 softirq
= kstat_cpu(i
).cpustat
.softirq
;
529 steal
= kstat_cpu(i
).cpustat
.steal
;
530 guest
= kstat_cpu(i
).cpustat
.guest
;
532 "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
534 (unsigned long long)cputime64_to_clock_t(user
),
535 (unsigned long long)cputime64_to_clock_t(nice
),
536 (unsigned long long)cputime64_to_clock_t(system
),
537 (unsigned long long)cputime64_to_clock_t(idle
),
538 (unsigned long long)cputime64_to_clock_t(iowait
),
539 (unsigned long long)cputime64_to_clock_t(irq
),
540 (unsigned long long)cputime64_to_clock_t(softirq
),
541 (unsigned long long)cputime64_to_clock_t(steal
),
542 (unsigned long long)cputime64_to_clock_t(guest
));
544 seq_printf(p
, "intr %llu", (unsigned long long)sum
);
546 for (i
= 0; i
< NR_IRQS
; i
++)
547 seq_printf(p
, " %u", per_irq_sum
[i
]);
553 "procs_running %lu\n"
554 "procs_blocked %lu\n",
555 nr_context_switches(),
565 static int stat_open(struct inode
*inode
, struct file
*file
)
567 unsigned size
= 4096 * (1 + num_possible_cpus() / 32);
572 /* don't ask for more than the kmalloc() max size, currently 128 KB */
573 if (size
> 128 * 1024)
575 buf
= kmalloc(size
, GFP_KERNEL
);
579 res
= single_open(file
, show_stat
, NULL
);
581 m
= file
->private_data
;
588 static const struct file_operations proc_stat_operations
= {
592 .release
= single_release
,
598 static void *int_seq_start(struct seq_file
*f
, loff_t
*pos
)
600 return (*pos
<= NR_IRQS
) ? pos
: NULL
;
603 static void *int_seq_next(struct seq_file
*f
, void *v
, loff_t
*pos
)
611 static void int_seq_stop(struct seq_file
*f
, void *v
)
617 static const struct seq_operations int_seq_ops
= {
618 .start
= int_seq_start
,
619 .next
= int_seq_next
,
620 .stop
= int_seq_stop
,
621 .show
= show_interrupts
624 static int interrupts_open(struct inode
*inode
, struct file
*filp
)
626 return seq_open(filp
, &int_seq_ops
);
629 static const struct file_operations proc_interrupts_operations
= {
630 .open
= interrupts_open
,
633 .release
= seq_release
,
636 static int filesystems_read_proc(char *page
, char **start
, off_t off
,
637 int count
, int *eof
, void *data
)
639 int len
= get_filesystem_list(page
);
640 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
643 static int cmdline_read_proc(char *page
, char **start
, off_t off
,
644 int count
, int *eof
, void *data
)
648 len
= sprintf(page
, "%s\n", saved_command_line
);
649 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
652 static int locks_open(struct inode
*inode
, struct file
*filp
)
654 return seq_open(filp
, &locks_seq_operations
);
657 static const struct file_operations proc_locks_operations
= {
661 .release
= seq_release
,
664 static int execdomains_read_proc(char *page
, char **start
, off_t off
,
665 int count
, int *eof
, void *data
)
667 int len
= get_exec_domain_list(page
);
668 return proc_calc_metrics(page
, start
, off
, count
, eof
, len
);
671 #ifdef CONFIG_MAGIC_SYSRQ
673 * writing 'C' to /proc/sysrq-trigger is like sysrq-C
675 static ssize_t
write_sysrq_trigger(struct file
*file
, const char __user
*buf
,
676 size_t count
, loff_t
*ppos
)
681 if (get_user(c
, buf
))
683 __handle_sysrq(c
, NULL
, 0);
688 static const struct file_operations proc_sysrq_trigger_operations
= {
689 .write
= write_sysrq_trigger
,
693 #ifdef CONFIG_PROC_PAGE_MONITOR
694 #define KPMSIZE sizeof(u64)
695 #define KPMMASK (KPMSIZE - 1)
696 /* /proc/kpagecount - an array exposing page counts
698 * Each entry is a u64 representing the corresponding
699 * physical page count.
701 static ssize_t
kpagecount_read(struct file
*file
, char __user
*buf
,
702 size_t count
, loff_t
*ppos
)
704 u64 __user
*out
= (u64 __user
*)buf
;
706 unsigned long src
= *ppos
;
712 count
= min_t(size_t, count
, (max_pfn
* KPMSIZE
) - src
);
713 if (src
& KPMMASK
|| count
& KPMMASK
)
719 ppage
= pfn_to_page(pfn
);
724 pcount
= atomic_read(&ppage
->_count
);
726 if (put_user(pcount
, out
++)) {
734 *ppos
+= (char __user
*)out
- buf
;
736 ret
= (char __user
*)out
- buf
;
740 static struct file_operations proc_kpagecount_operations
= {
742 .read
= kpagecount_read
,
745 /* /proc/kpageflags - an array exposing page flags
747 * Each entry is a u64 representing the corresponding
748 * physical page flags.
751 /* These macros are used to decouple internal flags from exported ones */
755 #define KPF_REFERENCED 2
756 #define KPF_UPTODATE 3
761 #define KPF_WRITEBACK 8
762 #define KPF_RECLAIM 9
765 #define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
767 static ssize_t
kpageflags_read(struct file
*file
, char __user
*buf
,
768 size_t count
, loff_t
*ppos
)
770 u64 __user
*out
= (u64 __user
*)buf
;
772 unsigned long src
= *ppos
;
778 count
= min_t(unsigned long, count
, (max_pfn
* KPMSIZE
) - src
);
779 if (src
& KPMMASK
|| count
& KPMMASK
)
785 ppage
= pfn_to_page(pfn
);
790 kflags
= ppage
->flags
;
792 uflags
= kpf_copy_bit(KPF_LOCKED
, PG_locked
, kflags
) |
793 kpf_copy_bit(kflags
, KPF_ERROR
, PG_error
) |
794 kpf_copy_bit(kflags
, KPF_REFERENCED
, PG_referenced
) |
795 kpf_copy_bit(kflags
, KPF_UPTODATE
, PG_uptodate
) |
796 kpf_copy_bit(kflags
, KPF_DIRTY
, PG_dirty
) |
797 kpf_copy_bit(kflags
, KPF_LRU
, PG_lru
) |
798 kpf_copy_bit(kflags
, KPF_ACTIVE
, PG_active
) |
799 kpf_copy_bit(kflags
, KPF_SLAB
, PG_slab
) |
800 kpf_copy_bit(kflags
, KPF_WRITEBACK
, PG_writeback
) |
801 kpf_copy_bit(kflags
, KPF_RECLAIM
, PG_reclaim
) |
802 kpf_copy_bit(kflags
, KPF_BUDDY
, PG_buddy
);
804 if (put_user(uflags
, out
++)) {
812 *ppos
+= (char __user
*)out
- buf
;
814 ret
= (char __user
*)out
- buf
;
818 static struct file_operations proc_kpageflags_operations
= {
820 .read
= kpageflags_read
,
822 #endif /* CONFIG_PROC_PAGE_MONITOR */
824 struct proc_dir_entry
*proc_root_kcore
;
826 void create_seq_entry(char *name
, mode_t mode
, const struct file_operations
*f
)
828 struct proc_dir_entry
*entry
;
829 entry
= create_proc_entry(name
, mode
, NULL
);
831 entry
->proc_fops
= f
;
834 void __init
proc_misc_init(void)
838 int (*read_proc
)(char*,char**,off_t
,int,int*,void*);
839 } *p
, simple_ones
[] = {
840 {"loadavg", loadavg_read_proc
},
841 {"uptime", uptime_read_proc
},
842 {"meminfo", meminfo_read_proc
},
843 {"version", version_read_proc
},
844 #ifdef CONFIG_PROC_HARDWARE
845 {"hardware", hardware_read_proc
},
847 #ifdef CONFIG_STRAM_PROC
848 {"stram", stram_read_proc
},
850 {"filesystems", filesystems_read_proc
},
851 {"cmdline", cmdline_read_proc
},
852 {"execdomains", execdomains_read_proc
},
855 for (p
= simple_ones
; p
->name
; p
++)
856 create_proc_read_entry(p
->name
, 0, NULL
, p
->read_proc
, NULL
);
858 proc_symlink("mounts", NULL
, "self/mounts");
860 /* And now for trickier ones */
863 struct proc_dir_entry
*entry
;
864 entry
= create_proc_entry("kmsg", S_IRUSR
, &proc_root
);
866 entry
->proc_fops
= &proc_kmsg_operations
;
869 create_seq_entry("locks", 0, &proc_locks_operations
);
870 create_seq_entry("devices", 0, &proc_devinfo_operations
);
871 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations
);
873 create_seq_entry("partitions", 0, &proc_partitions_operations
);
875 create_seq_entry("stat", 0, &proc_stat_operations
);
876 create_seq_entry("interrupts", 0, &proc_interrupts_operations
);
877 #ifdef CONFIG_SLABINFO
878 create_seq_entry("slabinfo",S_IWUSR
|S_IRUGO
,&proc_slabinfo_operations
);
879 #ifdef CONFIG_DEBUG_SLAB_LEAK
880 create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations
);
883 create_seq_entry("buddyinfo",S_IRUGO
, &fragmentation_file_operations
);
884 create_seq_entry("pagetypeinfo", S_IRUGO
, &pagetypeinfo_file_ops
);
885 create_seq_entry("vmstat",S_IRUGO
, &proc_vmstat_file_operations
);
886 create_seq_entry("zoneinfo",S_IRUGO
, &proc_zoneinfo_file_operations
);
888 create_seq_entry("diskstats", 0, &proc_diskstats_operations
);
890 #ifdef CONFIG_MODULES
891 create_seq_entry("modules", 0, &proc_modules_operations
);
893 #ifdef CONFIG_SCHEDSTATS
894 create_seq_entry("schedstat", 0, &proc_schedstat_operations
);
896 #ifdef CONFIG_PROC_KCORE
897 proc_root_kcore
= create_proc_entry("kcore", S_IRUSR
, NULL
);
898 if (proc_root_kcore
) {
899 proc_root_kcore
->proc_fops
= &proc_kcore_operations
;
900 proc_root_kcore
->size
=
901 (size_t)high_memory
- PAGE_OFFSET
+ PAGE_SIZE
;
904 #ifdef CONFIG_PROC_PAGE_MONITOR
905 create_seq_entry("kpagecount", S_IRUSR
, &proc_kpagecount_operations
);
906 create_seq_entry("kpageflags", S_IRUSR
, &proc_kpageflags_operations
);
908 #ifdef CONFIG_PROC_VMCORE
909 proc_vmcore
= create_proc_entry("vmcore", S_IRUSR
, NULL
);
911 proc_vmcore
->proc_fops
= &proc_vmcore_operations
;
913 #ifdef CONFIG_MAGIC_SYSRQ
915 struct proc_dir_entry
*entry
;
916 entry
= create_proc_entry("sysrq-trigger", S_IWUSR
, NULL
);
918 entry
->proc_fops
= &proc_sysrq_trigger_operations
;