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
|
|
@ -174,6 +174,7 @@ struct procinfo {
|
|||
uint64 nvcsw, nivcsw; // voluntary / involuntary context switches
|
||||
char name[16];
|
||||
char exe[64]; // full path, for /proc/<pid>/exe
|
||||
int kthread; // a kernel thread, not a program
|
||||
};
|
||||
|
||||
struct proc {
|
||||
|
|
@ -321,6 +322,14 @@ struct proc {
|
|||
// chroot(2): where an absolute path starts, and where ".." stops. 0 is the
|
||||
// system's root. Inherited across fork, held as a reference like cwd.
|
||||
struct inode *root;
|
||||
|
||||
// Syscall tracing: every call and its result go to the log. Set by exec
|
||||
// when the program's name is the one written to /proc/strace, and kept
|
||||
// across fork so that what a traced program starts is traced too.
|
||||
int strace;
|
||||
|
||||
// umask(2). Inherited across fork; 022 for the first process.
|
||||
uint umask;
|
||||
};
|
||||
#define FD_CLOEXEC 1
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue