Control-Z the Sleep Signal

Erik Trulsson ertr1013 at student.uu.se
Tue Jun 9 22:15:49 UTC 2009


On Tue, Jun 09, 2009 at 11:42:15PM +0200, Polytropon wrote:
> On Tue, 09 Jun 2009 16:30:30 -0500, Martin McCormick <martin at dc.cis.okstate.edu> wrote:
> > Which signal is sent to a process when one types ^z or
> > Control-z? It appears to be SIGSTOP and according to signal's
> > man page, this is one signal you can't catch.
> 
> You can check the setting with this command:
> 
> 	% stty -a
> 	cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
> 	        eol2 = <undef>; erase = ^H; erase2 = ^H; intr = ^C; kill = ^U;
> 	        lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
> 	        status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;
> 	                                ^^^^^^^^^
> 
> This entry indicates that ^Z sends the suspend signal.

Not quite.  It indicates (according to stty(1)) that ^Z generates the
SUSP character.
The termios(4) manpage (referenced by stty(1)) says that

  SUSP    If the ISIG flag is enabled, receipt of the SUSP character causes
          a SIGTSTP signal to be sent to all processes in the foreground
          process group for which the terminal is the controlling terminal,
          and the SUSP character is discarded when processed.

So it appears to be SIGTSTP which is sent by typing ^Z, which agrees with
signal(3) where the SIGTSTP signal is described as "stop signal generated
from keyboard"





-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-questions mailing list