|
miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
|
#include <miniOS/types.h>

Go to the source code of this file.
Classes | |
| struct | minios_termios |
| struct | minios_winsize |
Macros | |
| #define | TTY_LFLAG_ISIG 0x0001u |
| #define | TTY_LFLAG_ICANON 0x0002u |
| #define | TTY_LFLAG_ECHO 0x0008u |
| #define | VINTR 0 |
| #define | VEOF 1 |
| #define | TTY_NCCS 8 |
| #define | TCGETS 0x5401UL |
| #define | TCSETS 0x5402UL |
| #define | TCSETSW 0x5403UL |
| #define | TCSETSF 0x5404UL |
| #define | TIOCSCTTY 0x540EUL |
| #define | TIOCGPGRP 0x540FUL |
| #define | TIOCSPGRP 0x5410UL |
| #define | TIOCGWINSZ 0x5413UL |
| #define | TIOCNOTTY 0x5422UL |
Functions | |
| 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. | |