Skip to content

TTY

Defined in: src/drivers/tty/tty.ts:67

One terminal, i.e. struct tty_struct.

new TTY(driver, index): TTY

Defined in: src/drivers/tty/tty.ts:79

TTYDriver

number

Which line of the driver this is, i.e. tty->index

TTY

optional device?: Device<unknown>

Defined in: src/drivers/tty/tty.ts:74

The device in sysfs, only set while the tty is registered


readonly driver: TTYDriver

Defined in: src/drivers/tty/tty.ts:80


optional foreground?: Process

Defined in: src/drivers/tty/tty.ts:77

What the terminal is in front of, i.e. tty->pgrp.


readonly index: number

Defined in: src/drivers/tty/tty.ts:82

Which line of the driver this is, i.e. tty->index


readonly ldisc: LineDiscipline

Defined in: src/drivers/tty/tty.ts:69

The line discipline, i.e. tty->ldisc. Only N_TTY exists.


readonly read_wait: WaitQueue

Defined in: src/drivers/tty/tty.ts:119

Whatever is waiting for input to arrive, i.e. tty->read_wait


termios: Termios

Defined in: src/drivers/tty/tty.ts:71

get available(): number

Defined in: src/drivers/tty/tty.ts:114

Bytes that have been read from the terminal and are waiting to be handed over

number


get dev_t(): object

Defined in: src/drivers/tty/tty.ts:93

object

major: number

minor: number


get name(): string

Defined in: src/drivers/tty/tty.ts:89

What this line is called, e.g. ttyS0 for line 0 of a driver named ttyS.

string


get readable(): boolean

Defined in: src/drivers/tty/tty.ts:122

Whether a read would come back with something, i.e. input_available_p

boolean


get winsize(): WinSize

Defined in: src/drivers/tty/tty.ts:101

How big the terminal is. Terminals that can’t say are 80x24, the same default Linux uses.

WinSize

set winsize(size): void

Defined in: src/drivers/tty/tty.ts:109

Tell the terminal how big it is, i.e. TIOCSWINSZ. A driver that knows its own size keeps reporting that, since it is the one that can tell.

WinSize

void

protected attrs(): Record<string, DeviceAttribute>

Defined in: src/drivers/tty/tty.ts:189

The attributes the tty’s device gets in sysfs

Record<string, DeviceAttribute>


close(): void

Defined in: src/drivers/tty/tty.ts:157

Stop using the terminal

void


open(): void

Defined in: src/drivers/tty/tty.ts:152

Start using the terminal, i.e. the open half of tty_operations

void


receive(data): void

Defined in: src/drivers/tty/tty.ts:147

Take bytes from the terminal. Call this from whatever is driving the tty when the user types something.

string | Uint8Array<ArrayBufferLike>

void


register(name?): void

Defined in: src/drivers/tty/tty.ts:205

Add the tty to sysfs and /dev, i.e. tty_register_device.

string = ...

Overrides the name worked out from the driver, which is how /dev/tty and /dev/console get theirs

void


set_termios(termios): void

Defined in: src/drivers/tty/tty.ts:182

Change the line settings, i.e. TCSETS

Termios

void


signal(signal): boolean

Defined in: src/drivers/tty/tty.ts:165

Signal whatever the terminal is in front of, like what __isig and TIOCSWINSZ do.

Signal

boolean

whether there was anything to signal


unregister(): void

Defined in: src/drivers/tty/tty.ts:213

void


wait_read(waiter): () => void

Defined in: src/drivers/tty/tty.ts:130

Wait for input to arrive, i.e. add_wait_queue(&tty->read_wait, ...).

() => void

a function that stops waiting, i.e. remove_wait_queue

() => void


wake_read(): void

Defined in: src/drivers/tty/tty.ts:139

Let whatever is waiting know there is input to be read, i.e. wake_up_interruptible_poll(&tty->read_wait, EPOLLIN). The line discipline is what decides when that is, since only it knows whether a line is finished.

void


write(data): void

Defined in: src/drivers/tty/tty.ts:172

Send bytes to the terminal, after output processing

Uint8Array

void


write_raw(data): void

Defined in: src/drivers/tty/tty.ts:177

Send bytes to the terminal without output processing, e.g. for echoing

Uint8Array

void