kernel/irq/proc.c

Source file repositories/reference/linux-study-clean/kernel/irq/proc.c

File Facts

System
Linux kernel
Corpus path
kernel/irq/proc.c
Extension
.c
Size
17187 bytes
Lines
679
Domain
Core OS
Bucket
Scheduler, Processes, Timers, Sync, And Syscalls
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

if (desc) {
			*pos = irq_desc_get_irq(desc);
			/*
			 * If valid for output then try to acquire a reference
			 * count on the descriptor so that it can't be freed
			 * after dropping RCU read lock on return.
			 */
			if (irq_settings_proc_valid(desc) && irq_desc_get_ref(desc))
				return desc;
			(*pos)++;
		} else {
			*pos = total_nr_irqs;
			return ARCH_PROC_IRQDESC;
		}
	}
}

static void *irq_seq_start(struct seq_file *f, loff_t *pos)
{
	if (!*pos) {
		struct irq_proc_constraints *constr = f->private;

		constr->num_prec = READ_ONCE(irq_proc_constraints.num_prec);
		constr->chip_width = READ_ONCE(irq_proc_constraints.chip_width);
		constr->print_header = true;
	}
	return irq_seq_next_desc(pos);
}

static void *irq_seq_next(struct seq_file *f, void *v, loff_t *pos)
{
	if (v && v != ARCH_PROC_IRQDESC)
		irq_desc_put_ref(v);

	(*pos)++;
	return irq_seq_next_desc(pos);
}

static void irq_seq_stop(struct seq_file *f, void *v)
{
	if (v && v != ARCH_PROC_IRQDESC)
		irq_desc_put_ref(v);
}

static const struct seq_operations irq_seq_ops = {
	.start = irq_seq_start,
	.next  = irq_seq_next,
	.stop  = irq_seq_stop,
	.show  = irq_seq_show,
};

static int __init irq_proc_init(void)
{
	proc_create_seq_private("interrupts", 0, NULL, &irq_seq_ops,
				sizeof(irq_proc_constraints), NULL);
	return 0;
}
fs_initcall(irq_proc_init);

#endif

Annotation

Implementation Notes