CVSROOT:        /cvs
Module name:    src
Changes by:     clau...@cvs.openbsd.org 2025/01/22 05:42:46

Modified files:
        sys/kern       : kern_sig.c kern_synch.c 

Log message:
Make single_thread_check() always return when deep is true and not suspend
the curproc.

There are only two cases where deep != 0. One is the sleep API the other
is single_thread_set depending on flag. For single_thread_set() the error
never matters if SINGLE_DEEP is set. The call in exec will always return
ERESTART and the ones for pledge et al. do no error checking at all.

For the sleep API sleep_signal_check() now checks the returned errno and
for the new EWOULDBLOCK case it will either stop or ignore the error
depending on the nostop flag.

Also just return ERESTART for the unwind and exit cases since there is
no need to differentiate between the two.

On top of this check the proc p_stat before returning EWOULDBLOCK and
return 0 in case the thread is already stopped. This happens when a
thread calls sleep_setup() and then right after that single_thread_set()
is executed by another thread. The first thread is then immediatly put
to SSTOP and so sleep_signal_check() no longer needs to do something.
sleep_finish() will take care. This should fix debugging of multithreaded
processes.

OK mpi@

Reply via email to