Job control, function keys, and real sleeps
- SIGSTOP/SIGTSTP/SIGTTIN/SIGTTOU stop, SIGCONT resumes; the parent gets SIGCHLD and wait4 reports WUNTRACED/WCONTINUED; ps shows T. Ctrl-Z works, and mc no longer hangs waiting for its subshell to stop. - Blocking reads (console, pty, pipe) and sleeps take a pending stop and carry on after SIGCONT; a caught signal without SA_RESTART ends them with EINTR. - nanosleep reads tv_nsec (sleep 0.5 used to return at once), writes the remainder, and clock_nanosleep understands TIMER_ABSTIME. - rt_sigaction uses the k_sigaction layout for Linux-ABI processes: the old action's restorer was written 112 bytes past the caller's struct. Flags are kept; SIGKILL and SIGSTOP cannot be caught. - F1..F12 reach programs, as the Linux console sends them (PS/2, USB, I2C). - TIOCLINUX subcode 6 answers "no modifiers" instead of echoing the 6 back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
fd9d392416
commit
2372806862
13 changed files with 366 additions and 42 deletions
|
|
@ -624,6 +624,21 @@ consoleintr(int (*getc)(void))
|
|||
case KBD_PGDN: esc = "\033[6~"; break;
|
||||
case KBD_INS: esc = "\033[2~"; break;
|
||||
case KBD_DEL: esc = "\033[3~"; break;
|
||||
// The function keys, as the Linux console sends them -- the strings
|
||||
// the `linux` terminfo entry lists. Nothing sent them at all, so mc's
|
||||
// F10 never quit and htop's F-key bar was decoration.
|
||||
case KBD_F1: esc = "\033[[A"; break;
|
||||
case KBD_F1 + 1: esc = "\033[[B"; break;
|
||||
case KBD_F1 + 2: esc = "\033[[C"; break;
|
||||
case KBD_F1 + 3: esc = "\033[[D"; break;
|
||||
case KBD_F1 + 4: esc = "\033[[E"; break;
|
||||
case KBD_F1 + 5: esc = "\033[17~"; break;
|
||||
case KBD_F1 + 6: esc = "\033[18~"; break;
|
||||
case KBD_F1 + 7: esc = "\033[19~"; break;
|
||||
case KBD_F1 + 8: esc = "\033[20~"; break;
|
||||
case KBD_F1 + 9: esc = "\033[21~"; break;
|
||||
case KBD_F1 + 10: esc = "\033[23~"; break;
|
||||
case KBD_F12: esc = "\033[24~"; break;
|
||||
}
|
||||
if (esc) {
|
||||
// Not echoed. In raw mode -- which is where a line editor lives, and
|
||||
|
|
@ -727,6 +742,16 @@ consoleread(struct inode *ip, uint64 off, char *dst, int n)
|
|||
ilock(ip);
|
||||
return -EINTR;
|
||||
}
|
||||
if (sig_attention(myproc())) { // Ctrl-Z, or a handler to run
|
||||
release(&input_lock);
|
||||
int e = sig_blocking_check();
|
||||
if (e) {
|
||||
ilock(ip);
|
||||
return e;
|
||||
}
|
||||
acquire(&input_lock);
|
||||
continue;
|
||||
}
|
||||
sleep(&v->in.r, &input_lock);
|
||||
}
|
||||
c = v->in.buf[v->in.r++ % VT_INPUT_BUF];
|
||||
|
|
|
|||
Loading…
Reference in a new issue