Skip to content

[kernel] Fix problems associated with ^Z/SIGTSTP (terminal stop)#2509

Merged
ghaerr merged 3 commits intomasterfrom
sigstop
Dec 10, 2025
Merged

[kernel] Fix problems associated with ^Z/SIGTSTP (terminal stop)#2509
ghaerr merged 3 commits intomasterfrom
sigstop

Conversation

@ghaerr
Copy link
Copy Markdown
Owner

@ghaerr ghaerr commented Dec 10, 2025

Fixes various problems with the ELKS kernel and sash not working when a process is stopped via the terminal using ^Z (SIGTSTP).

Discovered in #2506 (comment).

Previously, when the VSUSP character was typed (default ^Z), the process was stopped but any waiting processes (e.g. the shell) weren't awakened, so the system appeared hung.

It was also found that sash was hanging in a waitpid loop waiting for the last job to complete which looped forever when a process was stopped, a separate problem. The waitpid syscall was waiting for stopped jobs, which is only supposed to happen when the WUNTRACED option is passed, so this was fixed too.

Finally, when a stopped job's parent died (e.g. the shell was exited after stopping a process), the stopped child process was not releasing its TTY group or session. This prevented the new shell from becoming a process group leader, which led to ^C or ^Z signals not working when typed.

This took awhile to get right, and I'm still wondering what the difference between a process session and a process group is.

It was also learned that one can't kill a stopped job with anything other than SIGCONT (8, to continue), or SIGKILL (9, to force exit). Since the ash shell is not currently configured for jobs support (for size reasons), and sash doesn't support them, using kill -8 is the only way to continue a stopped job, for now.

@ghaerr ghaerr merged commit cac2c44 into master Dec 10, 2025
1 check passed
@ghaerr ghaerr deleted the sigstop branch December 10, 2025 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant