Fix stopping of the current process, which was broken by the last commit.
authorSimon Schubert <corecode@dragonflybsd.org>
Thu, 22 Feb 2007 15:48:55 +0000 (15:48 +0000)
committerSimon Schubert <corecode@dragonflybsd.org>
Thu, 22 Feb 2007 15:48:55 +0000 (15:48 +0000)
commit6ed57d3d81f2fd6c60daaf75b230913f59570e65
tree8b3149dee5a7e1de86d20251a7db02f1297169a1
parentcebaf0af09873785971ae3f468ef0f22adf129cd
Fix stopping of the current process, which was broken by the last commit.

If the current process is still far inside the kernel and is going to
tsleep(), CURSIG()/issignal() in tsleep() have to see the pending signal;
holding the process in SSTOP is not enough.

However, if this is happening to a process which already received a stopping
signal and thus already is in SSTOP, but which wakes up for some reason, and
then posts a SA_STOP signal to itself, we may not ignore this, in spite of
already being in SSTOP.

All this process stopping business inside CURSIG()/issignal() makes all of
this very fragile, but we will have to live with it for now.

The bug can be reproduced by doing
% cat
^Z
% ps lx|grep '[c]at'

The correct output would be something like:
 4156 stop    p2  DL     0:00.00 cat

The broken behavior shows with:
17417 ttybg2  p2  TL     0:00.00 cat

Reviewed-by: Thomas E. Spanjaard <tgen@netphreax.net>
sys/kern/kern_sig.c