Go to the source code of this file.
|
| void | tty_init (void) |
| | Sets up the canonical input ring buffer, initialises the default termios (c_lflag = ICANON|ECHO|ISIG, VINTR=^C, VEOF=^D), and sets the window size to SCREEN_ROWS x SCREEN_COLS. Must be called once during kernel boot before tty_keyboard_input() or tty_read() are used.
|
| void | tty_keyboard_input (char c) |
| | In canonical mode (ICANON set): appends to the line buffer; on newline or VEOF flushes the complete line to the read buffer. In raw mode: writes directly to the read buffer. Echoes to vt_write_byte() if ECHO is set. Sends SIGINT to the foreground process group if ISIG is set and == VINTR. Called from the keyboard interrupt handler (IRQ1).
|
| void | tty_inject_escape (const char *seq, int len) |
| int | tty_has_data (void) |
| int | tty_read (void *buf, uint32_t len, int nonblock) |
| | In canonical mode: blocks (or returns -EAGAIN if nonblock) until a complete line is available, then copies up to @len bytes. In raw mode: returns as many bytes as are immediately available up to @len.
|
| int | tty_write (const void *buf, uint32_t len) |
| | Forwards each byte to vt_write_byte(), which handles ANSI/VT escape sequence parsing and VGA cell rendering.
|
| int | tty_ioctl (uint64_t cmd, uint64_t arg) |
| | TCGETS: copies current termios to *arg. TCSETS/TCSETSW: copies termios from *arg into the kernel TTY state. TIOCGWINSZ: copies the window size (SCREEN_ROWS x SCREEN_COLS) to *arg. TIOCSCTTY/TIOCNOTTY: accepted (no-op in single-TTY kernel).
|
| int | tty_isatty_fd (int fd) |
| | Returns 1 if the fd's vfs_file entry has ftype == VFS_FILE_TYPE_CHAR and device_type == VFS_DEVICE_TTY, 0 otherwise. Used by the isatty(3) Newlib stub.
|