8#include <aquila/termios.h>
9#include <aquila/ioctl.h>
84#define TTY_BUF_SIZE 512
void tty_hangup(struct tty *tty)
Hangs up a controlling terminal, when its session ends (its leader exited) or the terminal goes away:...
ssize_t tty_slave_write(struct tty *tty, size_t size, void *_buf)
Takes what programs write to the terminal, and sends it to the device through output processing (OPOS...
int tty_ioctl(struct tty *tty, int request, void *argp)
Handles a terminal's ioctl()s: its modes (TCGETS, TCSETS, ...), flushing, its session and foreground ...
int tty_free(struct tty *tty)
Ends a terminal: it is hung up, and freed.
ssize_t tty_write_iobuf(struct tty *tty, struct iobuf *io, ttyio write)
Writes to a terminal from an iobuf (user memory), to either side: a piece at a time through a kernel ...
int tty_new(struct proc *proc, size_t buf_size, ttyio master, ttyio slave, void *p, struct tty **ref)
Makes a new terminal, with the default modes (canonical, echo, signals, ICRNL, IXON,...
ssize_t tty_master_write(struct tty *tty, size_t size, void *buf)
Takes input from the terminal's device (the keyboard, a UART, or a pseudo-terminal's master),...
int tty_can_read(struct tty *tty, size_t buffered)
Says whether the terminal is readable, for select() and poll(): there is input, or an end-of-file.
int tty_eof(struct tty *tty)
Says whether a read that found nothing to return should return 0 at once: at an end-of-file (VEOF at ...
int tty_background(struct tty *tty, int sig)
Stops a background process that reads the terminal, writes it or changes it: if the current process i...
uint64_t tty_read_timeout(struct tty *tty)
Says how long a read waits for input: VTIME tenths of a second with VMIN 0 in non-canonical mode,...
void tty_open(struct tty *tty, struct file *file)
Handles a terminal device being opened: it becomes the controlling terminal of a session leader that ...
void tty_flush(struct tty *tty, int which)
Drops a terminal's input (TCIFLUSH, TCIOFLUSH): the line being edited, what the device holds for read...
unsigned long long int uint64_t
An open file (POSIX's "open file description", fs/file.c).
A process group: the processes of a job.
A terminal, and its line discipline's state.
struct pgroup * fg
the foreground process group, or NULL
size_t size
the size of cook
struct dev * dev
the terminal's device
ttyio master_write
writes to the master side: input, as if typed
size_t col
the output's column (for OPOST's ONOCR and ONLRET), and whether an ONLCR newline's CR was sent but no...
size_t pos
how much of cook is used
struct session * session
the session it is the controlling terminal of, or NULL
char * cook
the line being edited, in canonical mode
int stopped
whether output is stopped (IXON: VSTOP came); writes wait on start_wait for VSTART.
void * p
the device's own data
struct vnode * vnode
the device's vnode, which /dev/tty opens in its place
ttyio slave_write
writes to the slave side: output, for the device
void(*) input_flush(struct tty *tty)
discards the input that readers haven't read yet
int eof
how many end-of-files (VEOF at the start of a line) reads still have to return
ssize_t(*) ttyio(struct tty *tty, size_t size, void *buf)