proc_misc.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. /*
  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. #include <linux/types.h>
  18. #include <linux/errno.h>
  19. #include <linux/time.h>
  20. #include <linux/kernel.h>
  21. #include <linux/kernel_stat.h>
  22. #include <linux/fs.h>
  23. #include <linux/tty.h>
  24. #include <linux/string.h>
  25. #include <linux/mman.h>
  26. #include <linux/quicklist.h>
  27. #include <linux/proc_fs.h>
  28. #include <linux/ioport.h>
  29. #include <linux/mm.h>
  30. #include <linux/mmzone.h>
  31. #include <linux/pagemap.h>
  32. #include <linux/irq.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>
  54. #include <asm/io.h>
  55. #include <asm/tlb.h>
  56. #include <asm/div64.h>
  57. #include "internal.h"
  58. /*
  59. * Warning: stuff below (imported functions) assumes that its output will fit
  60. * into one page. For some of those functions it may be wrong. Moreover, we
  61. * have a way to deal with that gracefully. Right now I used straightforward
  62. * wrappers, but this needs further analysis wrt potential overflows.
  63. */
  64. static int proc_calc_metrics(char *page, char **start, off_t off,
  65. int count, int *eof, int len)
  66. {
  67. if (len <= off+count) *eof = 1;
  68. *start = page + off;
  69. len -= off;
  70. if (len>count) len = count;
  71. if (len<0) len = 0;
  72. return len;
  73. }
  74. static int fragmentation_open(struct inode *inode, struct file *file)
  75. {
  76. (void)inode;
  77. return seq_open(file, &fragmentation_op);
  78. }
  79. static const struct file_operations fragmentation_file_operations = {
  80. .open = fragmentation_open,
  81. .read = seq_read,
  82. .llseek = seq_lseek,
  83. .release = seq_release,
  84. };
  85. static int pagetypeinfo_open(struct inode *inode, struct file *file)
  86. {
  87. return seq_open(file, &pagetypeinfo_op);
  88. }
  89. static const struct file_operations pagetypeinfo_file_ops = {
  90. .open = pagetypeinfo_open,
  91. .read = seq_read,
  92. .llseek = seq_lseek,
  93. .release = seq_release,
  94. };
  95. static int zoneinfo_open(struct inode *inode, struct file *file)
  96. {
  97. return seq_open(file, &zoneinfo_op);
  98. }
  99. static const struct file_operations proc_zoneinfo_file_operations = {
  100. .open = zoneinfo_open,
  101. .read = seq_read,
  102. .llseek = seq_lseek,
  103. .release = seq_release,
  104. };
  105. extern const struct seq_operations cpuinfo_op;
  106. static int cpuinfo_open(struct inode *inode, struct file *file)
  107. {
  108. return seq_open(file, &cpuinfo_op);
  109. }
  110. static const struct file_operations proc_cpuinfo_operations = {
  111. .open = cpuinfo_open,
  112. .read = seq_read,
  113. .llseek = seq_lseek,
  114. .release = seq_release,
  115. };
  116. static int devinfo_show(struct seq_file *f, void *v)
  117. {
  118. int i = *(loff_t *) v;
  119. if (i < CHRDEV_MAJOR_HASH_SIZE) {
  120. if (i == 0)
  121. seq_printf(f, "Character devices:\n");
  122. chrdev_show(f, i);
  123. }
  124. #ifdef CONFIG_BLOCK
  125. else {
  126. i -= CHRDEV_MAJOR_HASH_SIZE;
  127. if (i == 0)
  128. seq_printf(f, "\nBlock devices:\n");
  129. blkdev_show(f, i);
  130. }
  131. #endif
  132. return 0;
  133. }
  134. static void *devinfo_start(struct seq_file *f, loff_t *pos)
  135. {
  136. if (*pos < (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE))
  137. return pos;
  138. return NULL;
  139. }
  140. static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos)
  141. {
  142. (*pos)++;
  143. if (*pos >= (BLKDEV_MAJOR_HASH_SIZE + CHRDEV_MAJOR_HASH_SIZE))
  144. return NULL;
  145. return pos;
  146. }
  147. static void devinfo_stop(struct seq_file *f, void *v)
  148. {
  149. /* Nothing to do */
  150. }
  151. static const struct seq_operations devinfo_ops = {
  152. .start = devinfo_start,
  153. .next = devinfo_next,
  154. .stop = devinfo_stop,
  155. .show = devinfo_show
  156. };
  157. static int devinfo_open(struct inode *inode, struct file *filp)
  158. {
  159. return seq_open(filp, &devinfo_ops);
  160. }
  161. static const struct file_operations proc_devinfo_operations = {
  162. .open = devinfo_open,
  163. .read = seq_read,
  164. .llseek = seq_lseek,
  165. .release = seq_release,
  166. };
  167. static int vmstat_open(struct inode *inode, struct file *file)
  168. {
  169. return seq_open(file, &vmstat_op);
  170. }
  171. static const struct file_operations proc_vmstat_file_operations = {
  172. .open = vmstat_open,
  173. .read = seq_read,
  174. .llseek = seq_lseek,
  175. .release = seq_release,
  176. };
  177. #ifdef CONFIG_BLOCK
  178. static int partitions_open(struct inode *inode, struct file *file)
  179. {
  180. return seq_open(file, &partitions_op);
  181. }
  182. static const struct file_operations proc_partitions_operations = {
  183. .open = partitions_open,
  184. .read = seq_read,
  185. .llseek = seq_lseek,
  186. .release = seq_release,
  187. };
  188. static int diskstats_open(struct inode *inode, struct file *file)
  189. {
  190. return seq_open(file, &diskstats_op);
  191. }
  192. static const struct file_operations proc_diskstats_operations = {
  193. .open = diskstats_open,
  194. .read = seq_read,
  195. .llseek = seq_lseek,
  196. .release = seq_release,
  197. };
  198. #endif
  199. #ifdef CONFIG_MODULES
  200. extern const struct seq_operations modules_op;
  201. static int modules_open(struct inode *inode, struct file *file)
  202. {
  203. return seq_open(file, &modules_op);
  204. }
  205. static const struct file_operations proc_modules_operations = {
  206. .open = modules_open,
  207. .read = seq_read,
  208. .llseek = seq_lseek,
  209. .release = seq_release,
  210. };
  211. #endif
  212. #ifdef CONFIG_SLABINFO
  213. static int slabinfo_open(struct inode *inode, struct file *file)
  214. {
  215. return seq_open(file, &slabinfo_op);
  216. }
  217. static const struct file_operations proc_slabinfo_operations = {
  218. .open = slabinfo_open,
  219. .read = seq_read,
  220. .write = slabinfo_write,
  221. .llseek = seq_lseek,
  222. .release = seq_release,
  223. };
  224. #ifdef CONFIG_DEBUG_SLAB_LEAK
  225. extern const struct seq_operations slabstats_op;
  226. static int slabstats_open(struct inode *inode, struct file *file)
  227. {
  228. unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL);
  229. int ret = -ENOMEM;
  230. if (n) {
  231. ret = seq_open(file, &slabstats_op);
  232. if (!ret) {
  233. struct seq_file *m = file->private_data;
  234. *n = PAGE_SIZE / (2 * sizeof(unsigned long));
  235. m->private = n;
  236. n = NULL;
  237. }
  238. kfree(n);
  239. }
  240. return ret;
  241. }
  242. static const struct file_operations proc_slabstats_operations = {
  243. .open = slabstats_open,
  244. .read = seq_read,
  245. .llseek = seq_lseek,
  246. .release = seq_release_private,
  247. };
  248. #endif
  249. #endif
  250. #ifdef CONFIG_MMU
  251. static int vmalloc_open(struct inode *inode, struct file *file)
  252. {
  253. unsigned int *ptr = NULL;
  254. int ret;
  255. if (NUMA_BUILD)
  256. ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL);
  257. ret = seq_open(file, &vmalloc_op);
  258. if (!ret) {
  259. struct seq_file *m = file->private_data;
  260. m->private = ptr;
  261. } else
  262. kfree(ptr);
  263. return ret;
  264. }
  265. static const struct file_operations proc_vmalloc_operations = {
  266. .open = vmalloc_open,
  267. .read = seq_read,
  268. .llseek = seq_lseek,
  269. .release = seq_release_private,
  270. };
  271. #endif
  272. #ifndef arch_irq_stat_cpu
  273. #define arch_irq_stat_cpu(cpu) 0
  274. #endif
  275. #ifndef arch_irq_stat
  276. #define arch_irq_stat() 0
  277. #endif
  278. static int show_stat(struct seq_file *p, void *v)
  279. {
  280. int i, j;
  281. unsigned long jif;
  282. cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
  283. cputime64_t guest;
  284. u64 sum = 0;
  285. struct timespec boottime;
  286. unsigned int per_irq_sum;
  287. user = nice = system = idle = iowait =
  288. irq = softirq = steal = cputime64_zero;
  289. guest = cputime64_zero;
  290. getboottime(&boottime);
  291. jif = boottime.tv_sec;
  292. for_each_possible_cpu(i) {
  293. user = cputime64_add(user, kstat_cpu(i).cpustat.user);
  294. nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice);
  295. system = cputime64_add(system, kstat_cpu(i).cpustat.system);
  296. idle = cputime64_add(idle, kstat_cpu(i).cpustat.idle);
  297. iowait = cputime64_add(iowait, kstat_cpu(i).cpustat.iowait);
  298. irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq);
  299. softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
  300. steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
  301. guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
  302. for_each_irq_nr(j)
  303. sum += kstat_irqs_cpu(j, i);
  304. sum += arch_irq_stat_cpu(i);
  305. }
  306. sum += arch_irq_stat();
  307. seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
  308. (unsigned long long)cputime64_to_clock_t(user),
  309. (unsigned long long)cputime64_to_clock_t(nice),
  310. (unsigned long long)cputime64_to_clock_t(system),
  311. (unsigned long long)cputime64_to_clock_t(idle),
  312. (unsigned long long)cputime64_to_clock_t(iowait),
  313. (unsigned long long)cputime64_to_clock_t(irq),
  314. (unsigned long long)cputime64_to_clock_t(softirq),
  315. (unsigned long long)cputime64_to_clock_t(steal),
  316. (unsigned long long)cputime64_to_clock_t(guest));
  317. for_each_online_cpu(i) {
  318. /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
  319. user = kstat_cpu(i).cpustat.user;
  320. nice = kstat_cpu(i).cpustat.nice;
  321. system = kstat_cpu(i).cpustat.system;
  322. idle = kstat_cpu(i).cpustat.idle;
  323. iowait = kstat_cpu(i).cpustat.iowait;
  324. irq = kstat_cpu(i).cpustat.irq;
  325. softirq = kstat_cpu(i).cpustat.softirq;
  326. steal = kstat_cpu(i).cpustat.steal;
  327. guest = kstat_cpu(i).cpustat.guest;
  328. seq_printf(p,
  329. "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
  330. i,
  331. (unsigned long long)cputime64_to_clock_t(user),
  332. (unsigned long long)cputime64_to_clock_t(nice),
  333. (unsigned long long)cputime64_to_clock_t(system),
  334. (unsigned long long)cputime64_to_clock_t(idle),
  335. (unsigned long long)cputime64_to_clock_t(iowait),
  336. (unsigned long long)cputime64_to_clock_t(irq),
  337. (unsigned long long)cputime64_to_clock_t(softirq),
  338. (unsigned long long)cputime64_to_clock_t(steal),
  339. (unsigned long long)cputime64_to_clock_t(guest));
  340. }
  341. seq_printf(p, "intr %llu", (unsigned long long)sum);
  342. /* sum again ? it could be updated? */
  343. for_each_irq_nr(j) {
  344. per_irq_sum = 0;
  345. for_each_possible_cpu(i)
  346. per_irq_sum += kstat_irqs_cpu(j, i);
  347. seq_printf(p, " %u", per_irq_sum);
  348. }
  349. seq_printf(p,
  350. "\nctxt %llu\n"
  351. "btime %lu\n"
  352. "processes %lu\n"
  353. "procs_running %lu\n"
  354. "procs_blocked %lu\n",
  355. nr_context_switches(),
  356. (unsigned long)jif,
  357. total_forks,
  358. nr_running(),
  359. nr_iowait());
  360. return 0;
  361. }
  362. static int stat_open(struct inode *inode, struct file *file)
  363. {
  364. unsigned size = 4096 * (1 + num_possible_cpus() / 32);
  365. char *buf;
  366. struct seq_file *m;
  367. int res;
  368. /* don't ask for more than the kmalloc() max size, currently 128 KB */
  369. if (size > 128 * 1024)
  370. size = 128 * 1024;
  371. buf = kmalloc(size, GFP_KERNEL);
  372. if (!buf)
  373. return -ENOMEM;
  374. res = single_open(file, show_stat, NULL);
  375. if (!res) {
  376. m = file->private_data;
  377. m->buf = buf;
  378. m->size = size;
  379. } else
  380. kfree(buf);
  381. return res;
  382. }
  383. static const struct file_operations proc_stat_operations = {
  384. .open = stat_open,
  385. .read = seq_read,
  386. .llseek = seq_lseek,
  387. .release = single_release,
  388. };
  389. /*
  390. * /proc/interrupts
  391. */
  392. static void *int_seq_start(struct seq_file *f, loff_t *pos)
  393. {
  394. return (*pos <= nr_irqs) ? pos : NULL;
  395. }
  396. static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
  397. {
  398. (*pos)++;
  399. return (*pos <= nr_irqs) ? pos : NULL;
  400. }
  401. static void int_seq_stop(struct seq_file *f, void *v)
  402. {
  403. /* Nothing to do */
  404. }
  405. static const struct seq_operations int_seq_ops = {
  406. .start = int_seq_start,
  407. .next = int_seq_next,
  408. .stop = int_seq_stop,
  409. .show = show_interrupts
  410. };
  411. static int interrupts_open(struct inode *inode, struct file *filp)
  412. {
  413. return seq_open(filp, &int_seq_ops);
  414. }
  415. static const struct file_operations proc_interrupts_operations = {
  416. .open = interrupts_open,
  417. .read = seq_read,
  418. .llseek = seq_lseek,
  419. .release = seq_release,
  420. };
  421. #ifdef CONFIG_FILE_LOCKING
  422. static int locks_open(struct inode *inode, struct file *filp)
  423. {
  424. return seq_open(filp, &locks_seq_operations);
  425. }
  426. static const struct file_operations proc_locks_operations = {
  427. .open = locks_open,
  428. .read = seq_read,
  429. .llseek = seq_lseek,
  430. .release = seq_release,
  431. };
  432. #endif /* CONFIG_FILE_LOCKING */
  433. #ifdef CONFIG_PROC_PAGE_MONITOR
  434. #define KPMSIZE sizeof(u64)
  435. #define KPMMASK (KPMSIZE - 1)
  436. /* /proc/kpagecount - an array exposing page counts
  437. *
  438. * Each entry is a u64 representing the corresponding
  439. * physical page count.
  440. */
  441. static ssize_t kpagecount_read(struct file *file, char __user *buf,
  442. size_t count, loff_t *ppos)
  443. {
  444. u64 __user *out = (u64 __user *)buf;
  445. struct page *ppage;
  446. unsigned long src = *ppos;
  447. unsigned long pfn;
  448. ssize_t ret = 0;
  449. u64 pcount;
  450. pfn = src / KPMSIZE;
  451. count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
  452. if (src & KPMMASK || count & KPMMASK)
  453. return -EINVAL;
  454. while (count > 0) {
  455. ppage = NULL;
  456. if (pfn_valid(pfn))
  457. ppage = pfn_to_page(pfn);
  458. pfn++;
  459. if (!ppage)
  460. pcount = 0;
  461. else
  462. pcount = page_mapcount(ppage);
  463. if (put_user(pcount, out++)) {
  464. ret = -EFAULT;
  465. break;
  466. }
  467. count -= KPMSIZE;
  468. }
  469. *ppos += (char __user *)out - buf;
  470. if (!ret)
  471. ret = (char __user *)out - buf;
  472. return ret;
  473. }
  474. static struct file_operations proc_kpagecount_operations = {
  475. .llseek = mem_lseek,
  476. .read = kpagecount_read,
  477. };
  478. /* /proc/kpageflags - an array exposing page flags
  479. *
  480. * Each entry is a u64 representing the corresponding
  481. * physical page flags.
  482. */
  483. /* These macros are used to decouple internal flags from exported ones */
  484. #define KPF_LOCKED 0
  485. #define KPF_ERROR 1
  486. #define KPF_REFERENCED 2
  487. #define KPF_UPTODATE 3
  488. #define KPF_DIRTY 4
  489. #define KPF_LRU 5
  490. #define KPF_ACTIVE 6
  491. #define KPF_SLAB 7
  492. #define KPF_WRITEBACK 8
  493. #define KPF_RECLAIM 9
  494. #define KPF_BUDDY 10
  495. #define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
  496. static ssize_t kpageflags_read(struct file *file, char __user *buf,
  497. size_t count, loff_t *ppos)
  498. {
  499. u64 __user *out = (u64 __user *)buf;
  500. struct page *ppage;
  501. unsigned long src = *ppos;
  502. unsigned long pfn;
  503. ssize_t ret = 0;
  504. u64 kflags, uflags;
  505. pfn = src / KPMSIZE;
  506. count = min_t(unsigned long, count, (max_pfn * KPMSIZE) - src);
  507. if (src & KPMMASK || count & KPMMASK)
  508. return -EINVAL;
  509. while (count > 0) {
  510. ppage = NULL;
  511. if (pfn_valid(pfn))
  512. ppage = pfn_to_page(pfn);
  513. pfn++;
  514. if (!ppage)
  515. kflags = 0;
  516. else
  517. kflags = ppage->flags;
  518. uflags = kpf_copy_bit(KPF_LOCKED, PG_locked, kflags) |
  519. kpf_copy_bit(kflags, KPF_ERROR, PG_error) |
  520. kpf_copy_bit(kflags, KPF_REFERENCED, PG_referenced) |
  521. kpf_copy_bit(kflags, KPF_UPTODATE, PG_uptodate) |
  522. kpf_copy_bit(kflags, KPF_DIRTY, PG_dirty) |
  523. kpf_copy_bit(kflags, KPF_LRU, PG_lru) |
  524. kpf_copy_bit(kflags, KPF_ACTIVE, PG_active) |
  525. kpf_copy_bit(kflags, KPF_SLAB, PG_slab) |
  526. kpf_copy_bit(kflags, KPF_WRITEBACK, PG_writeback) |
  527. kpf_copy_bit(kflags, KPF_RECLAIM, PG_reclaim) |
  528. kpf_copy_bit(kflags, KPF_BUDDY, PG_buddy);
  529. if (put_user(uflags, out++)) {
  530. ret = -EFAULT;
  531. break;
  532. }
  533. count -= KPMSIZE;
  534. }
  535. *ppos += (char __user *)out - buf;
  536. if (!ret)
  537. ret = (char __user *)out - buf;
  538. return ret;
  539. }
  540. static struct file_operations proc_kpageflags_operations = {
  541. .llseek = mem_lseek,
  542. .read = kpageflags_read,
  543. };
  544. #endif /* CONFIG_PROC_PAGE_MONITOR */
  545. struct proc_dir_entry *proc_root_kcore;
  546. void __init proc_misc_init(void)
  547. {
  548. static struct {
  549. char *name;
  550. int (*read_proc)(char*,char**,off_t,int,int*,void*);
  551. } *p, simple_ones[] = {
  552. {NULL,}
  553. };
  554. for (p = simple_ones; p->name; p++)
  555. create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);
  556. proc_symlink("mounts", NULL, "self/mounts");
  557. /* And now for trickier ones */
  558. #ifdef CONFIG_PRINTK
  559. proc_create("kmsg", S_IRUSR, NULL, &proc_kmsg_operations);
  560. #endif
  561. #ifdef CONFIG_FILE_LOCKING
  562. proc_create("locks", 0, NULL, &proc_locks_operations);
  563. #endif
  564. proc_create("devices", 0, NULL, &proc_devinfo_operations);
  565. proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations);
  566. #ifdef CONFIG_BLOCK
  567. proc_create("partitions", 0, NULL, &proc_partitions_operations);
  568. #endif
  569. proc_create("stat", 0, NULL, &proc_stat_operations);
  570. proc_create("interrupts", 0, NULL, &proc_interrupts_operations);
  571. #ifdef CONFIG_SLABINFO
  572. proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations);
  573. #ifdef CONFIG_DEBUG_SLAB_LEAK
  574. proc_create("slab_allocators", 0, NULL, &proc_slabstats_operations);
  575. #endif
  576. #endif
  577. #ifdef CONFIG_MMU
  578. proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations);
  579. #endif
  580. proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations);
  581. proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops);
  582. proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations);
  583. proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations);
  584. #ifdef CONFIG_BLOCK
  585. proc_create("diskstats", 0, NULL, &proc_diskstats_operations);
  586. #endif
  587. #ifdef CONFIG_MODULES
  588. proc_create("modules", 0, NULL, &proc_modules_operations);
  589. #endif
  590. #ifdef CONFIG_SCHEDSTATS
  591. proc_create("schedstat", 0, NULL, &proc_schedstat_operations);
  592. #endif
  593. #ifdef CONFIG_PROC_KCORE
  594. proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations);
  595. if (proc_root_kcore)
  596. proc_root_kcore->size =
  597. (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
  598. #endif
  599. #ifdef CONFIG_PROC_PAGE_MONITOR
  600. proc_create("kpagecount", S_IRUSR, NULL, &proc_kpagecount_operations);
  601. proc_create("kpageflags", S_IRUSR, NULL, &proc_kpageflags_operations);
  602. #endif
  603. #ifdef CONFIG_PROC_VMCORE
  604. proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations);
  605. #endif
  606. }