blob: 61b25f4eabe6635bdf013e4879dd8e725f10f01d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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>
Neil Horman7170be52006-01-14 13:20:38 -080023#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include <linux/tty.h>
25#include <linux/string.h>
26#include <linux/mman.h>
KOSAKI Motohiro4b856152008-09-02 14:35:53 -070027#include <linux/quicklist.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include <linux/proc_fs.h>
29#include <linux/ioport.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include <linux/mm.h>
31#include <linux/mmzone.h>
32#include <linux/pagemap.h>
Adrian Bunkf74596d2008-02-06 01:36:35 -080033#include <linux/interrupt.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include <linux/swap.h>
35#include <linux/slab.h>
Adrian Bunka0db7012008-03-04 11:23:50 +010036#include <linux/genhd.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070037#include <linux/smp.h>
38#include <linux/signal.h>
39#include <linux/module.h>
40#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#include <linux/seq_file.h>
42#include <linux/times.h>
43#include <linux/profile.h>
Andrew Morton7bf65382006-12-08 02:41:14 -080044#include <linux/utsname.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#include <linux/blkdev.h>
46#include <linux/hugetlb.h>
47#include <linux/jiffies.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070048#include <linux/vmalloc.h>
Vivek Goyal666bfdd2005-06-25 14:58:21 -070049#include <linux/crash_dump.h>
Sukadev Bhattiprolu61a58c62006-12-08 02:37:58 -080050#include <linux/pid_namespace.h>
Matt Mackall161f47b2008-02-04 22:29:05 -080051#include <linux/bootmem.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070052#include <asm/uaccess.h>
53#include <asm/pgtable.h>
54#include <asm/io.h>
55#include <asm/tlb.h>
56#include <asm/div64.h>
57#include "internal.h"
58
59#define LOAD_INT(x) ((x) >> FSHIFT)
60#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
61/*
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.
66 */
67extern int get_hardware_list(char *);
68extern int get_stram_list(char *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070069extern int get_exec_domain_list(char *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070070
71static int proc_calc_metrics(char *page, char **start, off_t off,
72 int count, int *eof, int len)
73{
74 if (len <= off+count) *eof = 1;
75 *start = page + off;
76 len -= off;
77 if (len>count) len = count;
78 if (len<0) len = 0;
79 return len;
80}
81
82static int loadavg_read_proc(char *page, char **start, off_t off,
83 int count, int *eof, void *data)
84{
85 int a, b, c;
86 int len;
Michal Schmidt07a154b2008-02-06 01:37:07 -080087 unsigned long seq;
Linus Torvalds1da177e2005-04-16 15:20:36 -070088
Michal Schmidt07a154b2008-02-06 01:37:07 -080089 do {
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));
95
Linus Torvalds1da177e2005-04-16 15:20:36 -070096 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),
Sukadev Bhattiprolu2894d6502007-10-18 23:39:49 -0700100 nr_running(), nr_threads,
101 task_active_pid_ns(current)->last_pid);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102 return proc_calc_metrics(page, start, off, count, eof, len);
103}
104
105static int uptime_read_proc(char *page, char **start, off_t off,
106 int count, int *eof, void *data)
107{
108 struct timespec uptime;
109 struct timespec idle;
110 int len;
111 cputime_t idletime = cputime_add(init_task.utime, init_task.stime);
112
113 do_posix_clock_monotonic_gettime(&uptime);
Tomas Janousekd6214142007-07-15 23:39:42 -0700114 monotonic_to_bootbased(&uptime);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 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)));
121
122 return proc_calc_metrics(page, start, off, count, eof, len);
123}
124
Andi Kleence0c0e52008-05-02 11:46:49 +0200125int __attribute__((weak)) arch_report_meminfo(char *page)
126{
127 return 0;
128}
129
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130static int meminfo_read_proc(char *page, char **start, off_t off,
131 int count, int *eof, void *data)
132{
133 struct sysinfo i;
134 int len;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135 unsigned long committed;
136 unsigned long allowed;
137 struct vmalloc_info vmi;
Martin Hicks4c4c4022005-04-16 15:24:08 -0700138 long cached;
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700139 unsigned long pages[NR_LRU_LISTS];
140 int lru;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142/*
143 * display in kilobytes.
144 */
145#define K(x) ((x) << (PAGE_SHIFT - 10))
146 si_meminfo(&i);
147 si_swapinfo(&i);
Alan Cox80119ef2008-05-23 13:04:31 -0700148 committed = atomic_long_read(&vm_committed_space);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149 allowed = ((totalram_pages - hugetlb_total_pages())
150 * sysctl_overcommit_ratio / 100) + total_swap_pages;
151
Christoph Lameter347ce432006-06-30 01:55:35 -0700152 cached = global_page_state(NR_FILE_PAGES) -
153 total_swapcache_pages - i.bufferram;
Martin Hicks4c4c4022005-04-16 15:24:08 -0700154 if (cached < 0)
155 cached = 0;
156
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 get_vmalloc_info(&vmi);
158
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700159 for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++)
160 pages[lru] = global_page_state(NR_LRU_BASE + lru);
161
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 /*
163 * Tagged format, for easy grepping and expansion.
164 */
165 len = sprintf(page,
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700166 "MemTotal: %8lu kB\n"
167 "MemFree: %8lu kB\n"
168 "Buffers: %8lu kB\n"
169 "Cached: %8lu kB\n"
170 "SwapCached: %8lu kB\n"
171 "Active: %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"
Lee Schermerhorn7b854122008-10-18 20:26:40 -0700177#ifdef CONFIG_UNEVICTABLE_LRU
178 "Unevictable: %8lu kB\n"
Nick Piggin5344b7e2008-10-18 20:26:51 -0700179 "Mlocked: %8lu kB\n"
Lee Schermerhorn7b854122008-10-18 20:26:40 -0700180#endif
Christoph Lameter182e8e22006-09-25 23:31:10 -0700181#ifdef CONFIG_HIGHMEM
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700182 "HighTotal: %8lu kB\n"
183 "HighFree: %8lu kB\n"
184 "LowTotal: %8lu kB\n"
185 "LowFree: %8lu kB\n"
Christoph Lameter182e8e22006-09-25 23:31:10 -0700186#endif
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700187 "SwapTotal: %8lu kB\n"
188 "SwapFree: %8lu kB\n"
189 "Dirty: %8lu kB\n"
190 "Writeback: %8lu kB\n"
191 "AnonPages: %8lu kB\n"
192 "Mapped: %8lu kB\n"
193 "Slab: %8lu kB\n"
194 "SReclaimable: %8lu kB\n"
195 "SUnreclaim: %8lu kB\n"
196 "PageTables: %8lu kB\n"
Hugh Dickinsd7a3e492008-09-13 02:33:13 -0700197#ifdef CONFIG_QUICKLIST
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700198 "Quicklists: %8lu kB\n"
Hugh Dickinsd7a3e492008-09-13 02:33:13 -0700199#endif
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700200 "NFS_Unstable: %8lu kB\n"
201 "Bounce: %8lu kB\n"
202 "WritebackTmp: %8lu kB\n"
203 "CommitLimit: %8lu kB\n"
204 "Committed_AS: %8lu kB\n"
205 "VmallocTotal: %8lu kB\n"
206 "VmallocUsed: %8lu kB\n"
207 "VmallocChunk: %8lu kB\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 K(i.totalram),
209 K(i.freeram),
210 K(i.bufferram),
Martin Hicks4c4c4022005-04-16 15:24:08 -0700211 K(cached),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 K(total_swapcache_pages),
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700213 K(pages[LRU_ACTIVE_ANON] + pages[LRU_ACTIVE_FILE]),
214 K(pages[LRU_INACTIVE_ANON] + pages[LRU_INACTIVE_FILE]),
215 K(pages[LRU_ACTIVE_ANON]),
216 K(pages[LRU_INACTIVE_ANON]),
217 K(pages[LRU_ACTIVE_FILE]),
218 K(pages[LRU_INACTIVE_FILE]),
Lee Schermerhorn7b854122008-10-18 20:26:40 -0700219#ifdef CONFIG_UNEVICTABLE_LRU
220 K(pages[LRU_UNEVICTABLE]),
Nick Piggin5344b7e2008-10-18 20:26:51 -0700221 K(global_page_state(NR_MLOCK)),
Lee Schermerhorn7b854122008-10-18 20:26:40 -0700222#endif
Christoph Lameter182e8e22006-09-25 23:31:10 -0700223#ifdef CONFIG_HIGHMEM
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 K(i.totalhigh),
225 K(i.freehigh),
226 K(i.totalram-i.totalhigh),
227 K(i.freeram-i.freehigh),
Christoph Lameter182e8e22006-09-25 23:31:10 -0700228#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 K(i.totalswap),
230 K(i.freeswap),
Christoph Lameterb1e7a8f2006-06-30 01:55:39 -0700231 K(global_page_state(NR_FILE_DIRTY)),
Christoph Lameterce866b32006-06-30 01:55:40 -0700232 K(global_page_state(NR_WRITEBACK)),
Christoph Lameterf3dbd342006-06-30 01:55:36 -0700233 K(global_page_state(NR_ANON_PAGES)),
Christoph Lameter65ba55f2006-06-30 01:55:34 -0700234 K(global_page_state(NR_FILE_MAPPED)),
Christoph Lameter972d1a72006-09-25 23:31:51 -0700235 K(global_page_state(NR_SLAB_RECLAIMABLE) +
236 global_page_state(NR_SLAB_UNRECLAIMABLE)),
237 K(global_page_state(NR_SLAB_RECLAIMABLE)),
238 K(global_page_state(NR_SLAB_UNRECLAIMABLE)),
Christoph Lameterdf849a12006-06-30 01:55:38 -0700239 K(global_page_state(NR_PAGETABLE)),
Hugh Dickinsd7a3e492008-09-13 02:33:13 -0700240#ifdef CONFIG_QUICKLIST
241 K(quicklist_total_size()),
242#endif
Christoph Lameterfd39fc82006-06-30 01:55:40 -0700243 K(global_page_state(NR_UNSTABLE_NFS)),
Christoph Lameterd2c5e302006-06-30 01:55:41 -0700244 K(global_page_state(NR_BOUNCE)),
Miklos Szeredifc3ba692008-04-30 00:54:38 -0700245 K(global_page_state(NR_WRITEBACK_TEMP)),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246 K(allowed),
247 K(committed),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248 (unsigned long)VMALLOC_TOTAL >> 10,
249 vmi.used >> 10,
Hugh Dickinsd7a3e492008-09-13 02:33:13 -0700250 vmi.largest_chunk >> 10
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251 );
252
253 len += hugetlb_report_meminfo(page + len);
254
Andi Kleence0c0e52008-05-02 11:46:49 +0200255 len += arch_report_meminfo(page + len);
256
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257 return proc_calc_metrics(page, start, off, count, eof, len);
258#undef K
259}
260
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261static int fragmentation_open(struct inode *inode, struct file *file)
262{
263 (void)inode;
264 return seq_open(file, &fragmentation_op);
265}
266
Arjan van de Ven00977a52007-02-12 00:55:34 -0800267static const struct file_operations fragmentation_file_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 .open = fragmentation_open,
269 .read = seq_read,
270 .llseek = seq_lseek,
271 .release = seq_release,
272};
273
Mel Gorman467c9962007-10-16 01:26:02 -0700274static int pagetypeinfo_open(struct inode *inode, struct file *file)
275{
276 return seq_open(file, &pagetypeinfo_op);
277}
278
279static const struct file_operations pagetypeinfo_file_ops = {
280 .open = pagetypeinfo_open,
281 .read = seq_read,
282 .llseek = seq_lseek,
283 .release = seq_release,
284};
285
Nikita Danilov295ab932005-06-21 17:14:38 -0700286static int zoneinfo_open(struct inode *inode, struct file *file)
287{
288 return seq_open(file, &zoneinfo_op);
289}
290
Arjan van de Ven00977a52007-02-12 00:55:34 -0800291static const struct file_operations proc_zoneinfo_file_operations = {
Nikita Danilov295ab932005-06-21 17:14:38 -0700292 .open = zoneinfo_open,
293 .read = seq_read,
294 .llseek = seq_lseek,
295 .release = seq_release,
296};
297
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298static int version_read_proc(char *page, char **start, off_t off,
299 int count, int *eof, void *data)
300{
301 int len;
302
Roman Zippel3eb3c742007-01-10 14:45:28 +0100303 len = snprintf(page, PAGE_SIZE, linux_proc_banner,
Linus Torvalds89937802006-12-11 09:28:46 -0800304 utsname()->sysname,
305 utsname()->release,
306 utsname()->version);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307 return proc_calc_metrics(page, start, off, count, eof, len);
308}
309
Jan Engelhardt03a44822008-02-08 04:21:19 -0800310extern const struct seq_operations cpuinfo_op;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700311static int cpuinfo_open(struct inode *inode, struct file *file)
312{
313 return seq_open(file, &cpuinfo_op);
314}
Neil Horman7170be52006-01-14 13:20:38 -0800315
Arjan van de Ven00977a52007-02-12 00:55:34 -0800316static const struct file_operations proc_cpuinfo_operations = {
Joe Korty68eef3b2006-03-31 02:30:32 -0800317 .open = cpuinfo_open,
Neil Horman7170be52006-01-14 13:20:38 -0800318 .read = seq_read,
319 .llseek = seq_lseek,
320 .release = seq_release,
321};
322
Joe Korty68eef3b2006-03-31 02:30:32 -0800323static int devinfo_show(struct seq_file *f, void *v)
324{
325 int i = *(loff_t *) v;
326
327 if (i < CHRDEV_MAJOR_HASH_SIZE) {
328 if (i == 0)
329 seq_printf(f, "Character devices:\n");
330 chrdev_show(f, i);
David Howells93614012006-09-30 20:45:40 +0200331 }
332#ifdef CONFIG_BLOCK
333 else {
Joe Korty68eef3b2006-03-31 02:30:32 -0800334 i -= CHRDEV_MAJOR_HASH_SIZE;
335 if (i == 0)
336 seq_printf(f, "\nBlock devices:\n");
337 blkdev_show(f, i);
338 }
David Howells93614012006-09-30 20:45:40 +0200339#endif
Joe Korty68eef3b2006-03-31 02:30:32 -0800340 return 0;
341}
342
343static void *devinfo_start(struct seq_file *f, loff_t *pos)
344{
345 if (*pos < (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE))
346 return pos;
347 return NULL;
348}
349
350static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos)
351{
352 (*pos)++;
353 if (*pos >= (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE))
354 return NULL;
355 return pos;
356}
357
358static void devinfo_stop(struct seq_file *f, void *v)
359{
360 /* Nothing to do */
361}
362
Jan Engelhardt03a44822008-02-08 04:21:19 -0800363static const struct seq_operations devinfo_ops = {
Joe Korty68eef3b2006-03-31 02:30:32 -0800364 .start = devinfo_start,
365 .next = devinfo_next,
366 .stop = devinfo_stop,
367 .show = devinfo_show
368};
369
370static int devinfo_open(struct inode *inode, struct file *filp)
371{
372 return seq_open(filp, &devinfo_ops);
373}
374
Arjan van de Ven00977a52007-02-12 00:55:34 -0800375static const struct file_operations proc_devinfo_operations = {
Joe Korty68eef3b2006-03-31 02:30:32 -0800376 .open = devinfo_open,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377 .read = seq_read,
378 .llseek = seq_lseek,
379 .release = seq_release,
380};
381
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382static int vmstat_open(struct inode *inode, struct file *file)
383{
384 return seq_open(file, &vmstat_op);
385}
Arjan van de Ven00977a52007-02-12 00:55:34 -0800386static const struct file_operations proc_vmstat_file_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387 .open = vmstat_open,
388 .read = seq_read,
389 .llseek = seq_lseek,
390 .release = seq_release,
391};
392
393#ifdef CONFIG_PROC_HARDWARE
394static int hardware_read_proc(char *page, char **start, off_t off,
395 int count, int *eof, void *data)
396{
397 int len = get_hardware_list(page);
398 return proc_calc_metrics(page, start, off, count, eof, len);
399}
400#endif
401
402#ifdef CONFIG_STRAM_PROC
403static int stram_read_proc(char *page, char **start, off_t off,
404 int count, int *eof, void *data)
405{
406 int len = get_stram_list(page);
407 return proc_calc_metrics(page, start, off, count, eof, len);
408}
409#endif
410
David Howells93614012006-09-30 20:45:40 +0200411#ifdef CONFIG_BLOCK
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412static int partitions_open(struct inode *inode, struct file *file)
413{
414 return seq_open(file, &partitions_op);
415}
Arjan van de Ven00977a52007-02-12 00:55:34 -0800416static const struct file_operations proc_partitions_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417 .open = partitions_open,
418 .read = seq_read,
419 .llseek = seq_lseek,
420 .release = seq_release,
421};
422
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423static int diskstats_open(struct inode *inode, struct file *file)
424{
425 return seq_open(file, &diskstats_op);
426}
Arjan van de Ven00977a52007-02-12 00:55:34 -0800427static const struct file_operations proc_diskstats_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 .open = diskstats_open,
429 .read = seq_read,
430 .llseek = seq_lseek,
431 .release = seq_release,
432};
David Howells93614012006-09-30 20:45:40 +0200433#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434
435#ifdef CONFIG_MODULES
Jan Engelhardt03a44822008-02-08 04:21:19 -0800436extern const struct seq_operations modules_op;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437static int modules_open(struct inode *inode, struct file *file)
438{
439 return seq_open(file, &modules_op);
440}
Arjan van de Ven00977a52007-02-12 00:55:34 -0800441static const struct file_operations proc_modules_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442 .open = modules_open,
443 .read = seq_read,
444 .llseek = seq_lseek,
445 .release = seq_release,
446};
447#endif
448
Linus Torvalds158a9622008-01-02 13:04:48 -0800449#ifdef CONFIG_SLABINFO
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450static int slabinfo_open(struct inode *inode, struct file *file)
451{
452 return seq_open(file, &slabinfo_op);
453}
Arjan van de Ven00977a52007-02-12 00:55:34 -0800454static const struct file_operations proc_slabinfo_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455 .open = slabinfo_open,
456 .read = seq_read,
457 .write = slabinfo_write,
458 .llseek = seq_lseek,
459 .release = seq_release,
460};
Al Viro871751e2006-03-25 03:06:39 -0800461
462#ifdef CONFIG_DEBUG_SLAB_LEAK
Jan Engelhardt03a44822008-02-08 04:21:19 -0800463extern const struct seq_operations slabstats_op;
Al Viro871751e2006-03-25 03:06:39 -0800464static int slabstats_open(struct inode *inode, struct file *file)
465{
466 unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL);
467 int ret = -ENOMEM;
468 if (n) {
469 ret = seq_open(file, &slabstats_op);
470 if (!ret) {
471 struct seq_file *m = file->private_data;
472 *n = PAGE_SIZE / (2 * sizeof(unsigned long));
473 m->private = n;
474 n = NULL;
475 }
476 kfree(n);
477 }
478 return ret;
479}
480
Arjan van de Ven00977a52007-02-12 00:55:34 -0800481static const struct file_operations proc_slabstats_operations = {
Al Viro871751e2006-03-25 03:06:39 -0800482 .open = slabstats_open,
483 .read = seq_read,
484 .llseek = seq_lseek,
Martin Peschke09f08922007-05-08 00:29:26 -0700485 .release = seq_release_private,
Al Viro871751e2006-03-25 03:06:39 -0800486};
487#endif
Matt Mackall10cef602006-01-08 01:01:45 -0800488#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489
Christoph Lametera10aa572008-04-28 02:12:40 -0700490#ifdef CONFIG_MMU
491static int vmalloc_open(struct inode *inode, struct file *file)
492{
Eric Dumazeta47a1262008-07-23 21:27:38 -0700493 unsigned int *ptr = NULL;
494 int ret;
495
496 if (NUMA_BUILD)
497 ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL);
498 ret = seq_open(file, &vmalloc_op);
499 if (!ret) {
500 struct seq_file *m = file->private_data;
501 m->private = ptr;
502 } else
503 kfree(ptr);
504 return ret;
Christoph Lametera10aa572008-04-28 02:12:40 -0700505}
506
507static const struct file_operations proc_vmalloc_operations = {
508 .open = vmalloc_open,
509 .read = seq_read,
510 .llseek = seq_lseek,
Eric Dumazeta47a1262008-07-23 21:27:38 -0700511 .release = seq_release_private,
Christoph Lametera10aa572008-04-28 02:12:40 -0700512};
513#endif
514
Jan Beulicha2eddfa2008-05-12 15:44:41 +0200515#ifndef arch_irq_stat_cpu
516#define arch_irq_stat_cpu(cpu) 0
517#endif
518#ifndef arch_irq_stat
519#define arch_irq_stat() 0
520#endif
521
Linus Torvalds1da177e2005-04-16 15:20:36 -0700522static int show_stat(struct seq_file *p, void *v)
523{
524 int i;
525 unsigned long jif;
526 cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
Laurent Vivier5e84cfd2007-10-15 17:00:19 +0200527 cputime64_t guest;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528 u64 sum = 0;
Tomas Janousek924b42d2007-07-15 23:39:42 -0700529 struct timespec boottime;
Ravikiran G Thirumalai4004c692007-07-19 01:47:53 -0700530 unsigned int *per_irq_sum;
531
532 per_irq_sum = kzalloc(sizeof(unsigned int)*NR_IRQS, GFP_KERNEL);
533 if (!per_irq_sum)
534 return -ENOMEM;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700535
536 user = nice = system = idle = iowait =
537 irq = softirq = steal = cputime64_zero;
Laurent Vivier5e84cfd2007-10-15 17:00:19 +0200538 guest = cputime64_zero;
Tomas Janousek924b42d2007-07-15 23:39:42 -0700539 getboottime(&boottime);
540 jif = boottime.tv_sec;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700541
KAMEZAWA Hiroyuki0a945022006-03-28 01:56:37 -0800542 for_each_possible_cpu(i) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543 int j;
544
545 user = cputime64_add(user, kstat_cpu(i).cpustat.user);
546 nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice);
547 system = cputime64_add(system, kstat_cpu(i).cpustat.system);
548 idle = cputime64_add(idle, kstat_cpu(i).cpustat.idle);
549 iowait = cputime64_add(iowait, kstat_cpu(i).cpustat.iowait);
550 irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq);
551 softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
552 steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
Laurent Vivier5e84cfd2007-10-15 17:00:19 +0200553 guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
Ravikiran G Thirumalai4004c692007-07-19 01:47:53 -0700554 for (j = 0; j < NR_IRQS; j++) {
555 unsigned int temp = kstat_cpu(i).irqs[j];
556 sum += temp;
557 per_irq_sum[j] += temp;
558 }
Jan Beulicha2eddfa2008-05-12 15:44:41 +0200559 sum += arch_irq_stat_cpu(i);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560 }
Jan Beulicha2eddfa2008-05-12 15:44:41 +0200561 sum += arch_irq_stat();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700562
Laurent Vivier5e84cfd2007-10-15 17:00:19 +0200563 seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 (unsigned long long)cputime64_to_clock_t(user),
565 (unsigned long long)cputime64_to_clock_t(nice),
566 (unsigned long long)cputime64_to_clock_t(system),
567 (unsigned long long)cputime64_to_clock_t(idle),
568 (unsigned long long)cputime64_to_clock_t(iowait),
569 (unsigned long long)cputime64_to_clock_t(irq),
570 (unsigned long long)cputime64_to_clock_t(softirq),
Laurent Vivier5e84cfd2007-10-15 17:00:19 +0200571 (unsigned long long)cputime64_to_clock_t(steal),
572 (unsigned long long)cputime64_to_clock_t(guest));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700573 for_each_online_cpu(i) {
574
575 /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
576 user = kstat_cpu(i).cpustat.user;
577 nice = kstat_cpu(i).cpustat.nice;
578 system = kstat_cpu(i).cpustat.system;
579 idle = kstat_cpu(i).cpustat.idle;
580 iowait = kstat_cpu(i).cpustat.iowait;
581 irq = kstat_cpu(i).cpustat.irq;
582 softirq = kstat_cpu(i).cpustat.softirq;
583 steal = kstat_cpu(i).cpustat.steal;
Laurent Vivier5e84cfd2007-10-15 17:00:19 +0200584 guest = kstat_cpu(i).cpustat.guest;
585 seq_printf(p,
586 "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587 i,
588 (unsigned long long)cputime64_to_clock_t(user),
589 (unsigned long long)cputime64_to_clock_t(nice),
590 (unsigned long long)cputime64_to_clock_t(system),
591 (unsigned long long)cputime64_to_clock_t(idle),
592 (unsigned long long)cputime64_to_clock_t(iowait),
593 (unsigned long long)cputime64_to_clock_t(irq),
594 (unsigned long long)cputime64_to_clock_t(softirq),
Laurent Vivier5e84cfd2007-10-15 17:00:19 +0200595 (unsigned long long)cputime64_to_clock_t(steal),
596 (unsigned long long)cputime64_to_clock_t(guest));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 }
598 seq_printf(p, "intr %llu", (unsigned long long)sum);
599
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600 for (i = 0; i < NR_IRQS; i++)
Ravikiran G Thirumalai4004c692007-07-19 01:47:53 -0700601 seq_printf(p, " %u", per_irq_sum[i]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602
603 seq_printf(p,
604 "\nctxt %llu\n"
605 "btime %lu\n"
606 "processes %lu\n"
607 "procs_running %lu\n"
608 "procs_blocked %lu\n",
609 nr_context_switches(),
610 (unsigned long)jif,
611 total_forks,
612 nr_running(),
613 nr_iowait());
614
Ravikiran G Thirumalai4004c692007-07-19 01:47:53 -0700615 kfree(per_irq_sum);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616 return 0;
617}
618
619static int stat_open(struct inode *inode, struct file *file)
620{
621 unsigned size = 4096 * (1 + num_possible_cpus() / 32);
622 char *buf;
623 struct seq_file *m;
624 int res;
625
626 /* don't ask for more than the kmalloc() max size, currently 128 KB */
627 if (size > 128 * 1024)
628 size = 128 * 1024;
629 buf = kmalloc(size, GFP_KERNEL);
630 if (!buf)
631 return -ENOMEM;
632
633 res = single_open(file, show_stat, NULL);
634 if (!res) {
635 m = file->private_data;
636 m->buf = buf;
637 m->size = size;
638 } else
639 kfree(buf);
640 return res;
641}
Arjan van de Ven00977a52007-02-12 00:55:34 -0800642static const struct file_operations proc_stat_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643 .open = stat_open,
644 .read = seq_read,
645 .llseek = seq_lseek,
646 .release = single_release,
647};
648
Linus Torvalds1da177e2005-04-16 15:20:36 -0700649/*
650 * /proc/interrupts
651 */
652static void *int_seq_start(struct seq_file *f, loff_t *pos)
653{
654 return (*pos <= NR_IRQS) ? pos : NULL;
655}
656
657static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
658{
659 (*pos)++;
660 if (*pos > NR_IRQS)
661 return NULL;
662 return pos;
663}
664
665static void int_seq_stop(struct seq_file *f, void *v)
666{
667 /* Nothing to do */
668}
669
670
Jan Engelhardt03a44822008-02-08 04:21:19 -0800671static const struct seq_operations int_seq_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700672 .start = int_seq_start,
673 .next = int_seq_next,
674 .stop = int_seq_stop,
675 .show = show_interrupts
676};
677
678static int interrupts_open(struct inode *inode, struct file *filp)
679{
680 return seq_open(filp, &int_seq_ops);
681}
682
Arjan van de Ven00977a52007-02-12 00:55:34 -0800683static const struct file_operations proc_interrupts_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 .open = interrupts_open,
685 .read = seq_read,
686 .llseek = seq_lseek,
687 .release = seq_release,
688};
689
690static int filesystems_read_proc(char *page, char **start, off_t off,
691 int count, int *eof, void *data)
692{
693 int len = get_filesystem_list(page);
694 return proc_calc_metrics(page, start, off, count, eof, len);
695}
696
697static int cmdline_read_proc(char *page, char **start, off_t off,
698 int count, int *eof, void *data)
699{
700 int len;
701
702 len = sprintf(page, "%s\n", saved_command_line);
703 return proc_calc_metrics(page, start, off, count, eof, len);
704}
705
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +0200706#ifdef CONFIG_FILE_LOCKING
Pavel Emelyanov7f8ada92007-10-01 14:41:15 -0700707static int locks_open(struct inode *inode, struct file *filp)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708{
Pavel Emelyanov7f8ada92007-10-01 14:41:15 -0700709 return seq_open(filp, &locks_seq_operations);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700710}
711
Pavel Emelyanov7f8ada92007-10-01 14:41:15 -0700712static const struct file_operations proc_locks_operations = {
713 .open = locks_open,
714 .read = seq_read,
715 .llseek = seq_lseek,
716 .release = seq_release,
717};
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +0200718#endif /* CONFIG_FILE_LOCKING */
Pavel Emelyanov7f8ada92007-10-01 14:41:15 -0700719
Linus Torvalds1da177e2005-04-16 15:20:36 -0700720static int execdomains_read_proc(char *page, char **start, off_t off,
721 int count, int *eof, void *data)
722{
723 int len = get_exec_domain_list(page);
724 return proc_calc_metrics(page, start, off, count, eof, len);
725}
726
Matt Mackall1e883282008-02-04 22:29:07 -0800727#ifdef CONFIG_PROC_PAGE_MONITOR
Matt Mackall161f47b2008-02-04 22:29:05 -0800728#define KPMSIZE sizeof(u64)
729#define KPMMASK (KPMSIZE - 1)
730/* /proc/kpagecount - an array exposing page counts
731 *
732 * Each entry is a u64 representing the corresponding
733 * physical page count.
734 */
735static ssize_t kpagecount_read(struct file *file, char __user *buf,
736 size_t count, loff_t *ppos)
737{
738 u64 __user *out = (u64 __user *)buf;
739 struct page *ppage;
740 unsigned long src = *ppos;
741 unsigned long pfn;
742 ssize_t ret = 0;
743 u64 pcount;
744
745 pfn = src / KPMSIZE;
746 count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
747 if (src & KPMMASK || count & KPMMASK)
Thomas Tuttle4710d1a2008-06-05 22:46:58 -0700748 return -EINVAL;
Matt Mackall161f47b2008-02-04 22:29:05 -0800749
750 while (count > 0) {
Matt Mackall304daa82008-02-04 22:29:06 -0800751 ppage = NULL;
752 if (pfn_valid(pfn))
753 ppage = pfn_to_page(pfn);
754 pfn++;
Matt Mackall161f47b2008-02-04 22:29:05 -0800755 if (!ppage)
756 pcount = 0;
757 else
Thomas Tuttlebbcdac02008-06-05 22:46:58 -0700758 pcount = page_mapcount(ppage);
Matt Mackall161f47b2008-02-04 22:29:05 -0800759
760 if (put_user(pcount, out++)) {
761 ret = -EFAULT;
762 break;
763 }
764
765 count -= KPMSIZE;
766 }
767
768 *ppos += (char __user *)out - buf;
769 if (!ret)
770 ret = (char __user *)out - buf;
771 return ret;
772}
773
774static struct file_operations proc_kpagecount_operations = {
775 .llseek = mem_lseek,
776 .read = kpagecount_read,
777};
778
Matt Mackall304daa82008-02-04 22:29:06 -0800779/* /proc/kpageflags - an array exposing page flags
780 *
781 * Each entry is a u64 representing the corresponding
782 * physical page flags.
783 */
784
785/* These macros are used to decouple internal flags from exported ones */
786
787#define KPF_LOCKED 0
788#define KPF_ERROR 1
789#define KPF_REFERENCED 2
790#define KPF_UPTODATE 3
791#define KPF_DIRTY 4
792#define KPF_LRU 5
793#define KPF_ACTIVE 6
794#define KPF_SLAB 7
795#define KPF_WRITEBACK 8
796#define KPF_RECLAIM 9
797#define KPF_BUDDY 10
798
799#define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
800
801static ssize_t kpageflags_read(struct file *file, char __user *buf,
802 size_t count, loff_t *ppos)
803{
804 u64 __user *out = (u64 __user *)buf;
805 struct page *ppage;
806 unsigned long src = *ppos;
807 unsigned long pfn;
808 ssize_t ret = 0;
809 u64 kflags, uflags;
810
811 pfn = src / KPMSIZE;
812 count = min_t(unsigned long, count, (max_pfn * KPMSIZE) - src);
813 if (src & KPMMASK || count & KPMMASK)
Thomas Tuttle4710d1a2008-06-05 22:46:58 -0700814 return -EINVAL;
Matt Mackall304daa82008-02-04 22:29:06 -0800815
816 while (count > 0) {
817 ppage = NULL;
818 if (pfn_valid(pfn))
819 ppage = pfn_to_page(pfn);
820 pfn++;
821 if (!ppage)
822 kflags = 0;
823 else
824 kflags = ppage->flags;
825
826 uflags = kpf_copy_bit(KPF_LOCKED, PG_locked, kflags) |
827 kpf_copy_bit(kflags, KPF_ERROR, PG_error) |
828 kpf_copy_bit(kflags, KPF_REFERENCED, PG_referenced) |
829 kpf_copy_bit(kflags, KPF_UPTODATE, PG_uptodate) |
830 kpf_copy_bit(kflags, KPF_DIRTY, PG_dirty) |
831 kpf_copy_bit(kflags, KPF_LRU, PG_lru) |
832 kpf_copy_bit(kflags, KPF_ACTIVE, PG_active) |
833 kpf_copy_bit(kflags, KPF_SLAB, PG_slab) |
834 kpf_copy_bit(kflags, KPF_WRITEBACK, PG_writeback) |
835 kpf_copy_bit(kflags, KPF_RECLAIM, PG_reclaim) |
836 kpf_copy_bit(kflags, KPF_BUDDY, PG_buddy);
837
838 if (put_user(uflags, out++)) {
839 ret = -EFAULT;
840 break;
841 }
842
843 count -= KPMSIZE;
844 }
845
846 *ppos += (char __user *)out - buf;
847 if (!ret)
848 ret = (char __user *)out - buf;
849 return ret;
850}
851
852static struct file_operations proc_kpageflags_operations = {
853 .llseek = mem_lseek,
854 .read = kpageflags_read,
855};
Matt Mackall1e883282008-02-04 22:29:07 -0800856#endif /* CONFIG_PROC_PAGE_MONITOR */
Matt Mackall304daa82008-02-04 22:29:06 -0800857
Linus Torvalds1da177e2005-04-16 15:20:36 -0700858struct proc_dir_entry *proc_root_kcore;
859
Linus Torvalds1da177e2005-04-16 15:20:36 -0700860void __init proc_misc_init(void)
861{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700862 static struct {
863 char *name;
864 int (*read_proc)(char*,char**,off_t,int,int*,void*);
865 } *p, simple_ones[] = {
866 {"loadavg", loadavg_read_proc},
867 {"uptime", uptime_read_proc},
868 {"meminfo", meminfo_read_proc},
869 {"version", version_read_proc},
870#ifdef CONFIG_PROC_HARDWARE
871 {"hardware", hardware_read_proc},
872#endif
873#ifdef CONFIG_STRAM_PROC
874 {"stram", stram_read_proc},
875#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700876 {"filesystems", filesystems_read_proc},
877 {"cmdline", cmdline_read_proc},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700878 {"execdomains", execdomains_read_proc},
879 {NULL,}
880 };
881 for (p = simple_ones; p->name; p++)
882 create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);
883
884 proc_symlink("mounts", NULL, "self/mounts");
885
886 /* And now for trickier ones */
Mike Galbraithc36264d2006-12-06 20:37:42 -0800887#ifdef CONFIG_PRINTK
Alexey Dobriyanc74c1202008-04-29 01:01:44 -0700888 proc_create("kmsg", S_IRUSR, NULL, &proc_kmsg_operations);
Mike Galbraithc36264d2006-12-06 20:37:42 -0800889#endif
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +0200890#ifdef CONFIG_FILE_LOCKING
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700891 proc_create("locks", 0, NULL, &proc_locks_operations);
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +0200892#endif
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700893 proc_create("devices", 0, NULL, &proc_devinfo_operations);
894 proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations);
David Howells93614012006-09-30 20:45:40 +0200895#ifdef CONFIG_BLOCK
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700896 proc_create("partitions", 0, NULL, &proc_partitions_operations);
David Howells93614012006-09-30 20:45:40 +0200897#endif
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700898 proc_create("stat", 0, NULL, &proc_stat_operations);
899 proc_create("interrupts", 0, NULL, &proc_interrupts_operations);
Linus Torvalds158a9622008-01-02 13:04:48 -0800900#ifdef CONFIG_SLABINFO
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700901 proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations);
Al Viro871751e2006-03-25 03:06:39 -0800902#ifdef CONFIG_DEBUG_SLAB_LEAK
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700903 proc_create("slab_allocators", 0, NULL, &proc_slabstats_operations);
Al Viro871751e2006-03-25 03:06:39 -0800904#endif
Matt Mackall10cef602006-01-08 01:01:45 -0800905#endif
Christoph Lametera10aa572008-04-28 02:12:40 -0700906#ifdef CONFIG_MMU
907 proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations);
908#endif
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700909 proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations);
910 proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops);
911 proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations);
912 proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations);
David Howells93614012006-09-30 20:45:40 +0200913#ifdef CONFIG_BLOCK
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700914 proc_create("diskstats", 0, NULL, &proc_diskstats_operations);
David Howells93614012006-09-30 20:45:40 +0200915#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700916#ifdef CONFIG_MODULES
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700917 proc_create("modules", 0, NULL, &proc_modules_operations);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700918#endif
919#ifdef CONFIG_SCHEDSTATS
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700920 proc_create("schedstat", 0, NULL, &proc_schedstat_operations);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700921#endif
922#ifdef CONFIG_PROC_KCORE
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700923 proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations);
924 if (proc_root_kcore)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700925 proc_root_kcore->size =
926 (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700927#endif
Matt Mackall1e883282008-02-04 22:29:07 -0800928#ifdef CONFIG_PROC_PAGE_MONITOR
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700929 proc_create("kpagecount", S_IRUSR, NULL, &proc_kpagecount_operations);
930 proc_create("kpageflags", S_IRUSR, NULL, &proc_kpageflags_operations);
Matt Mackall1e883282008-02-04 22:29:07 -0800931#endif
Vivek Goyal666bfdd2005-06-25 14:58:21 -0700932#ifdef CONFIG_PROC_VMCORE
Alexey Dobriyan0d5c9f52008-04-29 01:01:37 -0700933 proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations);
Vivek Goyal666bfdd2005-06-25 14:58:21 -0700934#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700935}