• Immutable Page
  • Info
  • Attachments

FAQ/Procfs

Documentation/filesystems/proc.txt

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/i386/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: } 


Tell others about this page:

last edited 2008-04-11 09:27:38 by tthtlc