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
|
|
@ -61,6 +61,10 @@ int pciuser_mmio_ok(uint64 phys, uint64 len);
|
|||
void pciuser_release_all(struct proc*);
|
||||
int pciuser_owner_pid(int idx);
|
||||
int proc_reincarnate(int status);
|
||||
int sig_default_stops(int);
|
||||
void proc_stop(int);
|
||||
int sig_attention(struct proc*);
|
||||
int sig_blocking_check(void);
|
||||
void proc_cputime(uint64 *user, uint64 *sys);
|
||||
// kernel/dev/procfs.c: /proc/strace
|
||||
int strace_wanted(const char *name);
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ struct procinfo {
|
|||
char name[16];
|
||||
char exe[64]; // full path, for /proc/<pid>/exe
|
||||
int kthread; // a kernel thread, not a program
|
||||
int stopped; // stopped by a signal (ps shows T)
|
||||
};
|
||||
|
||||
struct proc {
|
||||
|
|
@ -248,6 +249,7 @@ struct proc {
|
|||
// support nested signal delivery).
|
||||
uint64 sig_handler[32];
|
||||
uint64 sig_restorer[32];
|
||||
uint64 sig_flags[32]; // sa_flags; SA_RESTART is the one read
|
||||
struct trapframe saved_sigtf;
|
||||
int in_signal;
|
||||
|
||||
|
|
@ -330,6 +332,13 @@ struct proc {
|
|||
|
||||
// umask(2). Inherited across fork; 022 for the first process.
|
||||
uint umask;
|
||||
|
||||
// Job control. stopsig is the signal that stopped the process, 0 while it
|
||||
// runs; stop_report and cont_report are what wait(WUNTRACED/WCONTINUED)
|
||||
// has yet to tell the parent.
|
||||
int stopsig;
|
||||
int stop_report;
|
||||
int cont_report;
|
||||
};
|
||||
#define FD_CLOEXEC 1
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue