My OS is reaching the point where those little useful features neet to be implemented. One of these is Ctrl-C to terminate a running program in the current terminal.
Does anyone have suggestions on how this should (or could) be implemented? So-far most of the OS is posix-like, but there are parts which I see as too complex or just plain ugly.
The options I see are
- Keeping a list of processes with a handle open to the terminal in the terminal driver
- Implementing process group IDs and keeping the owning PGID in the terminal driver
- Keeping track of the owning thread/process for a terminal, and send the "signals" (may not be posix signals) to that thread and it passes them on
(as a note, I have a mechanism similar to signals for error handling, but in that case there is no kernel call to be interrupted, and the process is already running so there is no problem with needing to schedule the userland call)