proc_misc.c 18 KB

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