proc_misc.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  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/tty.h>
  23. #include <linux/string.h>
  24. #include <linux/mman.h>
  25. #include <linux/proc_fs.h>
  26. #include <linux/ioport.h>
  27. #include <linux/config.h>
  28. #include <linux/mm.h>
  29. #include <linux/mmzone.h>
  30. #include <linux/pagemap.h>
  31. #include <linux/swap.h>
  32. #include <linux/slab.h>
  33. #include <linux/smp.h>
  34. #include <linux/signal.h>
  35. #include <linux/module.h>
  36. #include <linux/init.h>
  37. #include <linux/smp_lock.h>
  38. #include <linux/seq_file.h>
  39. #include <linux/times.h>
  40. #include <linux/profile.h>
  41. #include <linux/blkdev.h>
  42. #include <linux/hugetlb.h>
  43. #include <linux/jiffies.h>
  44. #include <linux/sysrq.h>
  45. #include <linux/vmalloc.h>
  46. #include <linux/crash_dump.h>
  47. #include <asm/uaccess.h>
  48. #include <asm/pgtable.h>
  49. #include <asm/io.h>
  50. #include <asm/tlb.h>
  51. #include <asm/div64.h>
  52. #include "internal.h"
  53. #define LOAD_INT(x) ((x) >> FSHIFT)
  54. #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
  55. /*
  56. * Warning: stuff below (imported functions) assumes that its output will fit
  57. * into one page. For some of those functions it may be wrong. Moreover, we
  58. * have a way to deal with that gracefully. Right now I used straightforward
  59. * wrappers, but this needs further analysis wrt potential overflows.
  60. */
  61. extern int get_hardware_list(char *);
  62. extern int get_stram_list(char *);
  63. extern int get_chrdev_list(char *);
  64. extern int get_filesystem_list(char *);
  65. extern int get_exec_domain_list(char *);
  66. extern int get_dma_list(char *);
  67. extern int get_locks_status (char *, char **, off_t, int);
  68. static int proc_calc_metrics(char *page, char **start, off_t off,
  69. int count, int *eof, int len)
  70. {
  71. if (len <= off+count) *eof = 1;
  72. *start = page + off;
  73. len -= off;
  74. if (len>count) len = count;
  75. if (len<0) len = 0;
  76. return len;
  77. }
  78. static int loadavg_read_proc(char *page, char **start, off_t off,
  79. int count, int *eof, void *data)
  80. {
  81. int a, b, c;
  82. int len;
  83. a = avenrun[0] + (FIXED_1/200);
  84. b = avenrun[1] + (FIXED_1/200);
  85. c = avenrun[2] + (FIXED_1/200);
  86. len = sprintf(page,"%d.%02d %d.%02d %d.%02d %ld/%d %d\n",
  87. LOAD_INT(a), LOAD_FRAC(a),
  88. LOAD_INT(b), LOAD_FRAC(b),
  89. LOAD_INT(c), LOAD_FRAC(c),
  90. nr_running(), nr_threads, last_pid);
  91. return proc_calc_metrics(page, start, off, count, eof, len);
  92. }
  93. static int uptime_read_proc(char *page, char **start, off_t off,
  94. int count, int *eof, void *data)
  95. {
  96. struct timespec uptime;
  97. struct timespec idle;
  98. int len;
  99. cputime_t idletime = cputime_add(init_task.utime, init_task.stime);
  100. do_posix_clock_monotonic_gettime(&uptime);
  101. cputime_to_timespec(idletime, &idle);
  102. len = sprintf(page,"%lu.%02lu %lu.%02lu\n",
  103. (unsigned long) uptime.tv_sec,
  104. (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
  105. (unsigned long) idle.tv_sec,
  106. (idle.tv_nsec / (NSEC_PER_SEC / 100)));
  107. return proc_calc_metrics(page, start, off, count, eof, len);
  108. }
  109. static int meminfo_read_proc(char *page, char **start, off_t off,
  110. int count, int *eof, void *data)
  111. {
  112. struct sysinfo i;
  113. int len;
  114. struct page_state ps;
  115. unsigned long inactive;
  116. unsigned long active;
  117. unsigned long free;
  118. unsigned long committed;
  119. unsigned long allowed;
  120. struct vmalloc_info vmi;
  121. long cached;
  122. get_page_state(&ps);
  123. get_zone_counts(&active, &inactive, &free);
  124. /*
  125. * display in kilobytes.
  126. */
  127. #define K(x) ((x) << (PAGE_SHIFT - 10))
  128. si_meminfo(&i);
  129. si_swapinfo(&i);
  130. committed = atomic_read(&vm_committed_space);
  131. allowed = ((totalram_pages - hugetlb_total_pages())
  132. * sysctl_overcommit_ratio / 100) + total_swap_pages;
  133. cached = get_page_cache_size() - total_swapcache_pages - i.bufferram;
  134. if (cached < 0)
  135. cached = 0;
  136. get_vmalloc_info(&vmi);
  137. /*
  138. * Tagged format, for easy grepping and expansion.
  139. */
  140. len = sprintf(page,
  141. "MemTotal: %8lu kB\n"
  142. "MemFree: %8lu kB\n"
  143. "Buffers: %8lu kB\n"
  144. "Cached: %8lu kB\n"
  145. "SwapCached: %8lu kB\n"
  146. "Active: %8lu kB\n"
  147. "Inactive: %8lu kB\n"
  148. "HighTotal: %8lu kB\n"
  149. "HighFree: %8lu kB\n"
  150. "LowTotal: %8lu kB\n"
  151. "LowFree: %8lu kB\n"
  152. "SwapTotal: %8lu kB\n"
  153. "SwapFree: %8lu kB\n"
  154. "Dirty: %8lu kB\n"
  155. "Writeback: %8lu kB\n"
  156. "Mapped: %8lu kB\n"
  157. "Slab: %8lu kB\n"
  158. "CommitLimit: %8lu kB\n"
  159. "Committed_AS: %8lu kB\n"
  160. "PageTables: %8lu kB\n"
  161. "VmallocTotal: %8lu kB\n"
  162. "VmallocUsed: %8lu kB\n"
  163. "VmallocChunk: %8lu kB\n",
  164. K(i.totalram),
  165. K(i.freeram),
  166. K(i.bufferram),
  167. K(cached),
  168. K(total_swapcache_pages),
  169. K(active),
  170. K(inactive),
  171. K(i.totalhigh),
  172. K(i.freehigh),
  173. K(i.totalram-i.totalhigh),
  174. K(i.freeram-i.freehigh),
  175. K(i.totalswap),
  176. K(i.freeswap),
  177. K(ps.nr_dirty),
  178. K(ps.nr_writeback),
  179. K(ps.nr_mapped),
  180. K(ps.nr_slab),
  181. K(allowed),
  182. K(committed),
  183. K(ps.nr_page_table_pages),
  184. (unsigned long)VMALLOC_TOTAL >> 10,
  185. vmi.used >> 10,
  186. vmi.largest_chunk >> 10
  187. );
  188. len += hugetlb_report_meminfo(page + len);
  189. return proc_calc_metrics(page, start, off, count, eof, len);
  190. #undef K
  191. }
  192. extern struct seq_operations fragmentation_op;
  193. static int fragmentation_open(struct inode *inode, struct file *file)
  194. {
  195. (void)inode;
  196. return seq_open(file, &fragmentation_op);
  197. }
  198. static struct file_operations fragmentation_file_operations = {
  199. .open = fragmentation_open,
  200. .read = seq_read,
  201. .llseek = seq_lseek,
  202. .release = seq_release,
  203. };
  204. extern struct seq_operations zoneinfo_op;
  205. static int zoneinfo_open(struct inode *inode, struct file *file)
  206. {
  207. return seq_open(file, &zoneinfo_op);
  208. }
  209. static struct file_operations proc_zoneinfo_file_operations = {
  210. .open = zoneinfo_open,
  211. .read = seq_read,
  212. .llseek = seq_lseek,
  213. .release = seq_release,
  214. };
  215. static int version_read_proc(char *page, char **start, off_t off,
  216. int count, int *eof, void *data)
  217. {
  218. int len;
  219. strcpy(page, linux_banner);
  220. len = strlen(page);
  221. return proc_calc_metrics(page, start, off, count, eof, len);
  222. }
  223. extern struct seq_operations cpuinfo_op;
  224. static int cpuinfo_open(struct inode *inode, struct file *file)
  225. {
  226. return seq_open(file, &cpuinfo_op);
  227. }
  228. static struct file_operations proc_cpuinfo_operations = {
  229. .open = cpuinfo_open,
  230. .read = seq_read,
  231. .llseek = seq_lseek,
  232. .release = seq_release,
  233. };
  234. extern struct seq_operations vmstat_op;
  235. static int vmstat_open(struct inode *inode, struct file *file)
  236. {
  237. return seq_open(file, &vmstat_op);
  238. }
  239. static struct file_operations proc_vmstat_file_operations = {
  240. .open = vmstat_open,
  241. .read = seq_read,
  242. .llseek = seq_lseek,
  243. .release = seq_release,
  244. };
  245. #ifdef CONFIG_PROC_HARDWARE
  246. static int hardware_read_proc(char *page, char **start, off_t off,
  247. int count, int *eof, void *data)
  248. {
  249. int len = get_hardware_list(page);
  250. return proc_calc_metrics(page, start, off, count, eof, len);
  251. }
  252. #endif
  253. #ifdef CONFIG_STRAM_PROC
  254. static int stram_read_proc(char *page, char **start, off_t off,
  255. int count, int *eof, void *data)
  256. {
  257. int len = get_stram_list(page);
  258. return proc_calc_metrics(page, start, off, count, eof, len);
  259. }
  260. #endif
  261. extern struct seq_operations partitions_op;
  262. static int partitions_open(struct inode *inode, struct file *file)
  263. {
  264. return seq_open(file, &partitions_op);
  265. }
  266. static struct file_operations proc_partitions_operations = {
  267. .open = partitions_open,
  268. .read = seq_read,
  269. .llseek = seq_lseek,
  270. .release = seq_release,
  271. };
  272. extern struct seq_operations diskstats_op;
  273. static int diskstats_open(struct inode *inode, struct file *file)
  274. {
  275. return seq_open(file, &diskstats_op);
  276. }
  277. static struct file_operations proc_diskstats_operations = {
  278. .open = diskstats_open,
  279. .read = seq_read,
  280. .llseek = seq_lseek,
  281. .release = seq_release,
  282. };
  283. #ifdef CONFIG_MODULES
  284. extern struct seq_operations modules_op;
  285. static int modules_open(struct inode *inode, struct file *file)
  286. {
  287. return seq_open(file, &modules_op);
  288. }
  289. static struct file_operations proc_modules_operations = {
  290. .open = modules_open,
  291. .read = seq_read,
  292. .llseek = seq_lseek,
  293. .release = seq_release,
  294. };
  295. #endif
  296. extern struct seq_operations slabinfo_op;
  297. extern ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
  298. static int slabinfo_open(struct inode *inode, struct file *file)
  299. {
  300. return seq_open(file, &slabinfo_op);
  301. }
  302. static struct file_operations proc_slabinfo_operations = {
  303. .open = slabinfo_open,
  304. .read = seq_read,
  305. .write = slabinfo_write,
  306. .llseek = seq_lseek,
  307. .release = seq_release,
  308. };
  309. static int show_stat(struct seq_file *p, void *v)
  310. {
  311. int i;
  312. unsigned long jif;
  313. cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
  314. u64 sum = 0;
  315. user = nice = system = idle = iowait =
  316. irq = softirq = steal = cputime64_zero;
  317. jif = - wall_to_monotonic.tv_sec;
  318. if (wall_to_monotonic.tv_nsec)
  319. --jif;
  320. for_each_cpu(i) {
  321. int j;
  322. user = cputime64_add(user, kstat_cpu(i).cpustat.user);
  323. nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice);
  324. system = cputime64_add(system, kstat_cpu(i).cpustat.system);
  325. idle = cputime64_add(idle, kstat_cpu(i).cpustat.idle);
  326. iowait = cputime64_add(iowait, kstat_cpu(i).cpustat.iowait);
  327. irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq);
  328. softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
  329. steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
  330. for (j = 0 ; j < NR_IRQS ; j++)
  331. sum += kstat_cpu(i).irqs[j];
  332. }
  333. seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu\n",
  334. (unsigned long long)cputime64_to_clock_t(user),
  335. (unsigned long long)cputime64_to_clock_t(nice),
  336. (unsigned long long)cputime64_to_clock_t(system),
  337. (unsigned long long)cputime64_to_clock_t(idle),
  338. (unsigned long long)cputime64_to_clock_t(iowait),
  339. (unsigned long long)cputime64_to_clock_t(irq),
  340. (unsigned long long)cputime64_to_clock_t(softirq),
  341. (unsigned long long)cputime64_to_clock_t(steal));
  342. for_each_online_cpu(i) {
  343. /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
  344. user = kstat_cpu(i).cpustat.user;
  345. nice = kstat_cpu(i).cpustat.nice;
  346. system = kstat_cpu(i).cpustat.system;
  347. idle = kstat_cpu(i).cpustat.idle;
  348. iowait = kstat_cpu(i).cpustat.iowait;
  349. irq = kstat_cpu(i).cpustat.irq;
  350. softirq = kstat_cpu(i).cpustat.softirq;
  351. steal = kstat_cpu(i).cpustat.steal;
  352. seq_printf(p, "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu\n",
  353. i,
  354. (unsigned long long)cputime64_to_clock_t(user),
  355. (unsigned long long)cputime64_to_clock_t(nice),
  356. (unsigned long long)cputime64_to_clock_t(system),
  357. (unsigned long long)cputime64_to_clock_t(idle),
  358. (unsigned long long)cputime64_to_clock_t(iowait),
  359. (unsigned long long)cputime64_to_clock_t(irq),
  360. (unsigned long long)cputime64_to_clock_t(softirq),
  361. (unsigned long long)cputime64_to_clock_t(steal));
  362. }
  363. seq_printf(p, "intr %llu", (unsigned long long)sum);
  364. #if !defined(CONFIG_PPC64) && !defined(CONFIG_ALPHA)
  365. for (i = 0; i < NR_IRQS; i++)
  366. seq_printf(p, " %u", kstat_irqs(i));
  367. #endif
  368. seq_printf(p,
  369. "\nctxt %llu\n"
  370. "btime %lu\n"
  371. "processes %lu\n"
  372. "procs_running %lu\n"
  373. "procs_blocked %lu\n",
  374. nr_context_switches(),
  375. (unsigned long)jif,
  376. total_forks,
  377. nr_running(),
  378. nr_iowait());
  379. return 0;
  380. }
  381. static int stat_open(struct inode *inode, struct file *file)
  382. {
  383. unsigned size = 4096 * (1 + num_possible_cpus() / 32);
  384. char *buf;
  385. struct seq_file *m;
  386. int res;
  387. /* don't ask for more than the kmalloc() max size, currently 128 KB */
  388. if (size > 128 * 1024)
  389. size = 128 * 1024;
  390. buf = kmalloc(size, GFP_KERNEL);
  391. if (!buf)
  392. return -ENOMEM;
  393. res = single_open(file, show_stat, NULL);
  394. if (!res) {
  395. m = file->private_data;
  396. m->buf = buf;
  397. m->size = size;
  398. } else
  399. kfree(buf);
  400. return res;
  401. }
  402. static struct file_operations proc_stat_operations = {
  403. .open = stat_open,
  404. .read = seq_read,
  405. .llseek = seq_lseek,
  406. .release = single_release,
  407. };
  408. static int devices_read_proc(char *page, char **start, off_t off,
  409. int count, int *eof, void *data)
  410. {
  411. int len = get_chrdev_list(page);
  412. len += get_blkdev_list(page+len, len);
  413. return proc_calc_metrics(page, start, off, count, eof, len);
  414. }
  415. /*
  416. * /proc/interrupts
  417. */
  418. static void *int_seq_start(struct seq_file *f, loff_t *pos)
  419. {
  420. return (*pos <= NR_IRQS) ? pos : NULL;
  421. }
  422. static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
  423. {
  424. (*pos)++;
  425. if (*pos > NR_IRQS)
  426. return NULL;
  427. return pos;
  428. }
  429. static void int_seq_stop(struct seq_file *f, void *v)
  430. {
  431. /* Nothing to do */
  432. }
  433. extern int show_interrupts(struct seq_file *f, void *v); /* In arch code */
  434. static struct seq_operations int_seq_ops = {
  435. .start = int_seq_start,
  436. .next = int_seq_next,
  437. .stop = int_seq_stop,
  438. .show = show_interrupts
  439. };
  440. static int interrupts_open(struct inode *inode, struct file *filp)
  441. {
  442. return seq_open(filp, &int_seq_ops);
  443. }
  444. static struct file_operations proc_interrupts_operations = {
  445. .open = interrupts_open,
  446. .read = seq_read,
  447. .llseek = seq_lseek,
  448. .release = seq_release,
  449. };
  450. static int filesystems_read_proc(char *page, char **start, off_t off,
  451. int count, int *eof, void *data)
  452. {
  453. int len = get_filesystem_list(page);
  454. return proc_calc_metrics(page, start, off, count, eof, len);
  455. }
  456. static int cmdline_read_proc(char *page, char **start, off_t off,
  457. int count, int *eof, void *data)
  458. {
  459. int len;
  460. len = sprintf(page, "%s\n", saved_command_line);
  461. return proc_calc_metrics(page, start, off, count, eof, len);
  462. }
  463. static int locks_read_proc(char *page, char **start, off_t off,
  464. int count, int *eof, void *data)
  465. {
  466. int len = get_locks_status(page, start, off, count);
  467. if (len < count)
  468. *eof = 1;
  469. return len;
  470. }
  471. static int execdomains_read_proc(char *page, char **start, off_t off,
  472. int count, int *eof, void *data)
  473. {
  474. int len = get_exec_domain_list(page);
  475. return proc_calc_metrics(page, start, off, count, eof, len);
  476. }
  477. #ifdef CONFIG_MAGIC_SYSRQ
  478. /*
  479. * writing 'C' to /proc/sysrq-trigger is like sysrq-C
  480. */
  481. static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
  482. size_t count, loff_t *ppos)
  483. {
  484. if (count) {
  485. char c;
  486. if (get_user(c, buf))
  487. return -EFAULT;
  488. __handle_sysrq(c, NULL, NULL, 0);
  489. }
  490. return count;
  491. }
  492. static struct file_operations proc_sysrq_trigger_operations = {
  493. .write = write_sysrq_trigger,
  494. };
  495. #endif
  496. struct proc_dir_entry *proc_root_kcore;
  497. void create_seq_entry(char *name, mode_t mode, struct file_operations *f)
  498. {
  499. struct proc_dir_entry *entry;
  500. entry = create_proc_entry(name, mode, NULL);
  501. if (entry)
  502. entry->proc_fops = f;
  503. }
  504. void __init proc_misc_init(void)
  505. {
  506. struct proc_dir_entry *entry;
  507. static struct {
  508. char *name;
  509. int (*read_proc)(char*,char**,off_t,int,int*,void*);
  510. } *p, simple_ones[] = {
  511. {"loadavg", loadavg_read_proc},
  512. {"uptime", uptime_read_proc},
  513. {"meminfo", meminfo_read_proc},
  514. {"version", version_read_proc},
  515. #ifdef CONFIG_PROC_HARDWARE
  516. {"hardware", hardware_read_proc},
  517. #endif
  518. #ifdef CONFIG_STRAM_PROC
  519. {"stram", stram_read_proc},
  520. #endif
  521. {"devices", devices_read_proc},
  522. {"filesystems", filesystems_read_proc},
  523. {"cmdline", cmdline_read_proc},
  524. {"locks", locks_read_proc},
  525. {"execdomains", execdomains_read_proc},
  526. {NULL,}
  527. };
  528. for (p = simple_ones; p->name; p++)
  529. create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);
  530. proc_symlink("mounts", NULL, "self/mounts");
  531. /* And now for trickier ones */
  532. entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
  533. if (entry)
  534. entry->proc_fops = &proc_kmsg_operations;
  535. create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
  536. create_seq_entry("partitions", 0, &proc_partitions_operations);
  537. create_seq_entry("stat", 0, &proc_stat_operations);
  538. create_seq_entry("interrupts", 0, &proc_interrupts_operations);
  539. create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
  540. create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations);
  541. create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations);
  542. create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations);
  543. create_seq_entry("diskstats", 0, &proc_diskstats_operations);
  544. #ifdef CONFIG_MODULES
  545. create_seq_entry("modules", 0, &proc_modules_operations);
  546. #endif
  547. #ifdef CONFIG_SCHEDSTATS
  548. create_seq_entry("schedstat", 0, &proc_schedstat_operations);
  549. #endif
  550. #ifdef CONFIG_PROC_KCORE
  551. proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL);
  552. if (proc_root_kcore) {
  553. proc_root_kcore->proc_fops = &proc_kcore_operations;
  554. proc_root_kcore->size =
  555. (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
  556. }
  557. #endif
  558. #ifdef CONFIG_PROC_VMCORE
  559. proc_vmcore = create_proc_entry("vmcore", S_IRUSR, NULL);
  560. if (proc_vmcore)
  561. proc_vmcore->proc_fops = &proc_vmcore_operations;
  562. #endif
  563. #ifdef CONFIG_MAGIC_SYSRQ
  564. entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL);
  565. if (entry)
  566. entry->proc_fops = &proc_sysrq_trigger_operations;
  567. #endif
  568. #ifdef CONFIG_PPC32
  569. {
  570. extern struct file_operations ppc_htab_operations;
  571. entry = create_proc_entry("ppc_htab", S_IRUGO|S_IWUSR, NULL);
  572. if (entry)
  573. entry->proc_fops = &ppc_htab_operations;
  574. }
  575. #endif
  576. }