Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jun 2009 23:42:15 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Martin McCormick <martin@dc.cis.okstate.edu>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Control-Z the Sleep Signal
Message-ID:  <20090609234215.32201c06.freebsd@edvax.de>
In-Reply-To: <200906092130.n59LUU7E000141@dc.cis.okstate.edu>
References:  <200906092130.n59LUU7E000141@dc.cis.okstate.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 09 Jun 2009 16:30:30 -0500, Martin McCormick <martin@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, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090609234215.32201c06.freebsd>