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:
Nexoniarz 2026-10-25 02:37:45 +01:00
commit 2372806862
13 changed files with 366 additions and 42 deletions

View file

@ -24,6 +24,12 @@
[0xCB] = KBD_LF, [0xCD] = KBD_RT, \
[0x97] = KBD_HOME, [0xCF] = KBD_END, \
[0xD2] = KBD_INS, [0xD3] = KBD_DEL, \
[0x3B] = KBD_F1, [0x3C] = KBD_F1 + 1, \
[0x3D] = KBD_F1 + 2, [0x3E] = KBD_F1 + 3, \
[0x3F] = KBD_F1 + 4, [0x40] = KBD_F1 + 5, \
[0x41] = KBD_F1 + 6, [0x42] = KBD_F1 + 7, \
[0x43] = KBD_F1 + 8, [0x44] = KBD_F1 + 9, \
[0x57] = KBD_F1 + 10, [0x58] = KBD_F12, \
[0x9C] = '\n', /* KP_Enter */ \
[0xB5] = '/' /* KP_Div */

View file

@ -458,6 +458,16 @@ pts_read(struct inode *ip, uint64 off, char *dst, int n)
ilock(ip);
return got ? got : -EINTR;
}
if (sig_attention(myproc())) {
release(&ptylock);
int e = sig_blocking_check();
if (e) {
ilock(ip);
return got ? got : e;
}
acquire(&ptylock);
continue;
}
sleep(&p->ir, &ptylock);
}
c = p->in[p->ir++ % PTY_BUF];