to do.
* Use musl's solution for [EINTR] in the context of pthread
cancellation, checking the saved program counter when a signal
arrives. Although theoretically portable, it requires writing
architecture-specific code in practice.
* Use FreeBSD libthr's solution for [EINTR] in the context of pthread
cancellation, asking the kernel to abort the next blocking system call
with [EINTR] immediately from the signal handler. This is not portable
to other kernels.
--
Jilles Tjoelker
control manipulation is very hard to get right in the
general case. FreeBSD's su does it, and it needed various iterations to
fix hanging processes or unexpected logouts, some of which only occur
when the application is started from certain shells.
Also, it is not possible to fix generally cases like
su SOMEUSER -c 'while sleep 0.1; do echo @@@; done' | less
where there are other processes in the same process group as the one
doing job control manipulations. If su changes the tty's foreground
process group, it will prevent less from reconfiguring terminal modes.
--
Jilles Tjoelker