Pseudo-terminals, and what tmux and htop needed around them
- /dev/ptmx and /dev/pts/N: Unix98 pairs with a full line discipline, window sizes, job control and hangup (kernel/dev/pty.c). - The console speaks scroll regions, insert/delete line, SU/SD, RI/IND/NEL, DECSC/DECRC; swallows charset designations and private CSI sequences; and LF only returns the carriage under ONLCR. - setsid() drops the controlling terminal, so a pane's pty becomes its ctty. - pipe2() honours O_NONBLOCK and O_CLOEXEC (libevent's signal pipe). - File modes are stored and enforced: chmod, fchmod(at), umask, creation modes; /tmp is 1777. - /proc/stat has real user/system/idle; /proc/<pid>/task; kthread flag. - SO_PEERCRED, IOV_MAX 1024. - /proc/strace: name a program and its syscalls go to the kernel log. - World gains htop, btop, tmux, mc, ncdu, fastfetch, games, X toys, NetSurf. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
c65bfa3fa3
commit
fd9d392416
28 changed files with 1577 additions and 47 deletions
|
|
@ -82,7 +82,7 @@ struct vtcell {
|
|||
// Escape parser states. E_OSC and E_OSC_ESC exist for hyperlinks: a terminal
|
||||
// that does not follow OSC 8 must still consume it, or the URL is printed as
|
||||
// text. See the comment in kernel/core/console.c that this came from.
|
||||
enum { VE_NORMAL, VE_ESC, VE_CSI, VE_OSC, VE_OSC_ESC };
|
||||
enum { VE_NORMAL, VE_ESC, VE_CSI, VE_OSC, VE_OSC_ESC, VE_CHARSET };
|
||||
|
||||
struct vt {
|
||||
int index; // 0-based; /dev/tty<index+1>
|
||||
|
|
@ -98,6 +98,10 @@ struct vt {
|
|||
// CR, LF, backspace, an escape sequence -- clears it.
|
||||
int wrap_pending;
|
||||
int saved_cx, saved_cy; // DECSC/DECRC
|
||||
// The scrolling region, DECSTBM: rows scroll_top..scroll_bot inclusive.
|
||||
// scroll_bot 0 means unset, the whole screen -- which keeps a grid resized
|
||||
// underneath it from holding a stale bottom.
|
||||
int scroll_top, scroll_bot;
|
||||
|
||||
uint8 fg, bg; // current SGR colours
|
||||
int bold;
|
||||
|
|
|
|||
Loading…
Reference in a new issue