drivers/tty/vt/vt_ioctl.c
Source file repositories/reference/linux-study-clean/drivers/tty/vt/vt_ioctl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tty/vt/vt_ioctl.c- Extension
.c- Size
- 30518 bytes
- Lines
- 1316
- Domain
- Driver Families
- Bucket
- drivers/tty
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/errno.hlinux/sched/signal.hlinux/tty.hlinux/timer.hlinux/kernel.hlinux/compat.hlinux/module.hlinux/kd.hlinux/vt.hlinux/string.hlinux/slab.hlinux/major.hlinux/fs.hlinux/console.hlinux/consolemap.hlinux/signal.hlinux/suspend.hlinux/timex.hasm/io.hlinux/uaccess.hlinux/nospec.hlinux/kbd_kern.hlinux/vt_kern.hlinux/kbd_diacr.hlinux/selection.hasm/syscalls.h
Detected Declarations
struct vt_event_waitstruct compat_console_font_opstruct compat_unimapdescfunction vt_in_usefunction vt_busyfunction vt_event_postfunction list_for_eachfunction __vt_event_queuefunction __vt_event_waitfunction __vt_event_dequeuefunction vt_event_waitfunction vt_event_wait_ioctlfunction vt_waitactivefunction vt_kdsetmodefunction vt_k_ioctlfunction do_unimap_ioctlfunction vt_io_ioctlfunction vt_reldispfunction vt_setactivatefunction vt_disallocatefunction scoped_guardfunction vt_disallocate_allfunction vt_resizexfunction vt_ioctlfunction scoped_guardfunction reset_vcfunction vc_SAKfunction compat_kdfontop_ioctlfunction compat_unimap_ioctlfunction vt_compat_ioctlfunction complete_change_consolefunction framebufferfunction upfunction change_consolefunction vt_move_to_consolefunction scoped_guardfunction pm_set_vt_switchexport pm_set_vt_switch
Annotated Snippet
struct vt_event_wait {
struct list_head list;
struct vt_event event;
int done;
};
static LIST_HEAD(vt_events);
static DEFINE_SPINLOCK(vt_event_lock);
static DECLARE_WAIT_QUEUE_HEAD(vt_event_waitqueue);
/**
* vt_event_post
* @event: the event that occurred
* @old: old console
* @new: new console
*
* Post an VT event to interested VT handlers
*/
void vt_event_post(unsigned int event, unsigned int old, unsigned int new)
{
struct list_head *pos, *head;
unsigned long flags;
int wake = 0;
spin_lock_irqsave(&vt_event_lock, flags);
head = &vt_events;
list_for_each(pos, head) {
struct vt_event_wait *ve = list_entry(pos,
struct vt_event_wait, list);
if (!(ve->event.event & event))
continue;
ve->event.event = event;
/* kernel view is consoles 0..n-1, user space view is
console 1..n with 0 meaning current, so we must bias */
ve->event.oldev = old + 1;
ve->event.newev = new + 1;
wake = 1;
ve->done = 1;
}
spin_unlock_irqrestore(&vt_event_lock, flags);
if (wake)
wake_up_interruptible(&vt_event_waitqueue);
}
static void __vt_event_queue(struct vt_event_wait *vw)
{
unsigned long flags;
/* Prepare the event */
INIT_LIST_HEAD(&vw->list);
vw->done = 0;
/* Queue our event */
spin_lock_irqsave(&vt_event_lock, flags);
list_add(&vw->list, &vt_events);
spin_unlock_irqrestore(&vt_event_lock, flags);
}
static void __vt_event_wait(struct vt_event_wait *vw)
{
/* Wait for it to pass */
wait_event_interruptible(vt_event_waitqueue, vw->done);
}
static void __vt_event_dequeue(struct vt_event_wait *vw)
{
unsigned long flags;
/* Dequeue it */
spin_lock_irqsave(&vt_event_lock, flags);
list_del(&vw->list);
spin_unlock_irqrestore(&vt_event_lock, flags);
}
/**
* vt_event_wait - wait for an event
* @vw: our event
*
* Waits for an event to occur which completes our vt_event_wait
* structure. On return the structure has wv->done set to 1 for success
* or 0 if some event such as a signal ended the wait.
*/
static void vt_event_wait(struct vt_event_wait *vw)
{
__vt_event_queue(vw);
__vt_event_wait(vw);
__vt_event_dequeue(vw);
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/errno.h`, `linux/sched/signal.h`, `linux/tty.h`, `linux/timer.h`, `linux/kernel.h`, `linux/compat.h`, `linux/module.h`.
- Detected declarations: `struct vt_event_wait`, `struct compat_console_font_op`, `struct compat_unimapdesc`, `function vt_in_use`, `function vt_busy`, `function vt_event_post`, `function list_for_each`, `function __vt_event_queue`, `function __vt_event_wait`, `function __vt_event_dequeue`.
- Atlas domain: Driver Families / drivers/tty.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.