KernelNewbies
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Kernel Hacking

  • Frontpage

  • Kernel Hacking

  • Kernel Documentation

  • Kernel Glossary

  • FAQ

  • Found a bug?

  • Kernel Changelog

  • Upstream Merge Guide

Projects

  • KernelJanitors

  • KernelMentors

  • KernelProjects

Community

  • Why a community?

  • Regional Kernelnewbies

  • Personal Pages

  • Upcoming Events

References

  • Mailing Lists

  • Related Sites

  • Programming Links

Wiki

  • Recent Changes

  • Site Editors

  • Side Bar

  • Tips for Editors

  • Hosted by WikiWall

Navigation

  • RecentChanges
  • FindPage
  • HelpContents

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment

KernelNewbies:
  • FAQ
  • Procfs

Reference: Documentation/filesystems/proc.rst

And the implementation is in fs/proc/.

For processes - related information, it is mainly concentrated in task_mmu.c.

For interrupts enumeration (cat /proc/interrupts) the processing is done here:

arch/x86/kernel/irq.c

245:  * /proc/interrupts printing:
  246:  */
  247:
  248: int show_interrupts(struct seq_file *p, void *v)
  249: {
  250:         int i = *(loff_t *) v, j;
  251:         struct irqaction * action;
  252:         unsigned long flags;
  253:
  254:         if (i == 0) {
  255:                 seq_printf(p, "           ");
  256:                 for_each_online_cpu(j)
  257:                         seq_printf(p, "CPU%-8d",j);
  258:                 seq_putc(p, '\n');
  259:         }
  260:
  261:         if (i < NR_IRQS) {
  262:                 spin_lock_irqsave(&irq_desc[i].lock, flags);
  263:                 action = irq_desc[i].action;
  264:                 if (!action)
  265:                         goto skip;
  266:                 seq_printf(p, "%3d: ",i);
  267: #ifndef CONFIG_SMP
  268:                 seq_printf(p, "%10u ", kstat_irqs(i));
  269: #else
  270:                 for_each_online_cpu(j)
  271:                         seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
  272: #endif
  273:                 seq_printf(p, " %8s", irq_desc[i].chip->name);
  274:                 seq_printf(p, "-%-8s", irq_desc[i].name);
  275:                 seq_printf(p, "  %s", action->name);
  276:
  277:                 for (action=action->next; action; action = action->next)
  278:                         seq_printf(p, ", %s", action->name);
  279:
  280:                 seq_putc(p, '\n');
  281: skip:
  282:                 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
  283:         } else if (i == NR_IRQS) {
  284:                 seq_printf(p, "NMI: ");
  285:                 for_each_online_cpu(j)
  286:                         seq_printf(p, "%10u ", nmi_count(j));
  287:                 seq_putc(p, '\n');
  288: #ifdef CONFIG_X86_LOCAL_APIC
  289:                 seq_printf(p, "LOC: ");
  290:                 for_each_online_cpu(j)
  291:                         seq_printf(p, "%10u ",
  292:                                 per_cpu(irq_stat,j).apic_timer_irqs);
  293:                 seq_putc(p, '\n');
  294: #endif
  295:                 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
  296: #if defined(CONFIG_X86_IO_APIC)
  297:                 seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count));
  298: #endif
  299:         }
  300:         return 0;
  301: } 
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01