Control-Z the Sleep Signal

Polytropon freebsd at edvax.de
Tue Jun 9 21:42:25 UTC 2009


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.
According to 

	% stty -g
	... status=14:stop=13:susp=1a:time=0:werase=17: ...
	                      ^^^^^^^

and

	% man 3 signal

says that

     17    SIGSTOP      stop process         stop (cannot be caught or
                                             ignored)

And I think that 17 (decimal) is refered to as 1a (hexadecimal)
in the previous stty command.



> 	I have an application with a signal handler I wrote and
> I am trying to discourage folks typing CTRL-Z if it hangs
> because that does make it seem to go away but it is really still
> hanging around and any lock files it created are not removed.
> The effect is about as bad as if it crashed and left lock files.
> Normally, CTRL-c makes it remove the locks before exiting.

If I read the information above correctly, ^Z cannot be caught.



(I'm always interested in statements that correct me if I'm wrong.)



-- 
Polytropon
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list