proc_misc.c 17 KB

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