03.01.2012 00:07, Chet Ramey wrote:
background with `&'. On the other, if you want to move a foreground job to the background, you have to get it to give up control somehow, and sending it a signal is the way to do that.
Unless I am mistaken, nothing special is required for that, and SIGSTOP only makes waitpid() to return, but any other signal can be used to interrupt waitpid() with EINTR. But, in case of EINTR, bash simply restarts waitpid() it seems. So my wild guess is that the functionality of moving the process to the background can be implemented with some special type of trap that will not restart waitpid() after that signal is received. But anyway, I already have the workable solutions to this. :)