TTY
Defined in: src/drivers/tty/tty.ts:65
One terminal, i.e. struct tty_struct.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TTY(
driver,index):TTY
Defined in: src/drivers/tty/tty.ts:77
Parameters
Section titled “Parameters”driver
Section titled “driver”number
Which line of the driver this is, i.e. tty->index
Returns
Section titled “Returns”TTY
Properties
Section titled “Properties”device?
Section titled “device?”
optionaldevice?:Device<unknown>
Defined in: src/drivers/tty/tty.ts:72
The device in sysfs, only set while the tty is registered
driver
Section titled “driver”
readonlydriver:TTYDriver
Defined in: src/drivers/tty/tty.ts:78
foreground?
Section titled “foreground?”
optionalforeground?:Process
Defined in: src/drivers/tty/tty.ts:75
What the terminal is in front of, i.e. tty->pgrp.
readonlyindex:number
Defined in: src/drivers/tty/tty.ts:80
Which line of the driver this is, i.e. tty->index
readonlyldisc:LineDiscipline
Defined in: src/drivers/tty/tty.ts:67
The line discipline, i.e. tty->ldisc. Only N_TTY exists.
read_wait
Section titled “read_wait”
protectedreadonlyread_wait:Set<() =>void>
Defined in: src/drivers/tty/tty.ts:117
Whatever is waiting for input to arrive, i.e. tty->read_wait
termios
Section titled “termios”termios:
Termios
Defined in: src/drivers/tty/tty.ts:69
Accessors
Section titled “Accessors”available
Section titled “available”Get Signature
Section titled “Get Signature”get available():
number
Defined in: src/drivers/tty/tty.ts:112
Bytes that have been read from the terminal and are waiting to be handed over
Returns
Section titled “Returns”number
Get Signature
Section titled “Get Signature”get dev_t():
object
Defined in: src/drivers/tty/tty.ts:91
Returns
Section titled “Returns”object
major:
number
minor:
number
Get Signature
Section titled “Get Signature”get name():
string
Defined in: src/drivers/tty/tty.ts:87
What this line is called, e.g. ttyS0 for line 0 of a driver named ttyS.
Returns
Section titled “Returns”string
winsize
Section titled “winsize”Get Signature
Section titled “Get Signature”get winsize():
WinSize
Defined in: src/drivers/tty/tty.ts:99
How big the terminal is. Terminals that can’t say are 80x24, the same default Linux uses.
Returns
Section titled “Returns”Set Signature
Section titled “Set Signature”set winsize(
size):void
Defined in: src/drivers/tty/tty.ts:107
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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Methods
Section titled “Methods”attrs()
Section titled “attrs()”
protectedattrs():Record<string,DeviceAttribute>
Defined in: src/drivers/tty/tty.ts:185
The attributes the tty’s device gets in sysfs
Returns
Section titled “Returns”Record<string, DeviceAttribute>
close()
Section titled “close()”close():
void
Defined in: src/drivers/tty/tty.ts:153
Stop using the terminal
Returns
Section titled “Returns”void
open()
Section titled “open()”open():
void
Defined in: src/drivers/tty/tty.ts:148
Start using the terminal, i.e. the open half of tty_operations
Returns
Section titled “Returns”void
receive()
Section titled “receive()”receive(
data):void
Defined in: src/drivers/tty/tty.ts:143
Take bytes from the terminal. Call this from whatever is driving the tty when the user types something.
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike>
Returns
Section titled “Returns”void
register()
Section titled “register()”register(
name?):void
Defined in: src/drivers/tty/tty.ts:201
Add the tty to sysfs and /dev, i.e. tty_register_device.
Parameters
Section titled “Parameters”string = ...
Overrides the name worked out from the driver, which is how /dev/tty and /dev/console get theirs
Returns
Section titled “Returns”void
set_termios()
Section titled “set_termios()”set_termios(
termios):void
Defined in: src/drivers/tty/tty.ts:178
Change the line settings, i.e. TCSETS
Parameters
Section titled “Parameters”termios
Section titled “termios”Partial<Termios>
Returns
Section titled “Returns”void
signal()
Section titled “signal()”signal(
signal):boolean
Defined in: src/drivers/tty/tty.ts:161
Signal whatever the terminal is in front of, like what __isig and TIOCSWINSZ do.
Parameters
Section titled “Parameters”signal
Section titled “signal”Returns
Section titled “Returns”boolean
whether there was anything to signal
unregister()
Section titled “unregister()”unregister():
void
Defined in: src/drivers/tty/tty.ts:209
Returns
Section titled “Returns”void
wait_read()
Section titled “wait_read()”wait_read(
waiter): () =>void
Defined in: src/drivers/tty/tty.ts:125
Wait for input to arrive, i.e. add_wait_queue(&tty->read_wait, ...).
There is nothing to block on here, so a waiter is called once there is something to read
and reads it then, the way a woken task would.
Parameters
Section titled “Parameters”waiter
Section titled “waiter”() => void
Returns
Section titled “Returns”a function that stops waiting, i.e. remove_wait_queue
() => void
wake_read()
Section titled “wake_read()”wake_read():
void
Defined in: src/drivers/tty/tty.ts:135
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.
Returns
Section titled “Returns”void
write()
Section titled “write()”write(
data):void
Defined in: src/drivers/tty/tty.ts:168
Send bytes to the terminal, after output processing
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”void
write_raw()
Section titled “write_raw()”write_raw(
data):void
Defined in: src/drivers/tty/tty.ts:173
Send bytes to the terminal without output processing, e.g. for echoing
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”void