4.2BSD signal question.

Anthony V. Discolo discolo at ucsbcsl.UUCP
Fri Aug 31 04:10:36 AEST 1984


A friend of mine had an interesting problem with signals.  He has a
program that catches SIGHUP and SIGQUIT.  When the process is stopped,
sending it a SIGHUP will restart it, but sending it a SIGQUIT will not
restart it.  The SIGQUIT signal is received when the process is 
restarted, either by a SIGQUIT, or by a SIGCONT.

For example, a.out continuously prints periods, it will print an H
when it receives a SIGHUP, and it will print a Q when it receives
a SIGQUIT.  The following is a script that should explain the situation.
My comments are within {}.

			% a.out > OUT
			^Z
			Stopped
			% cat OUT
			......................
			% cat OUT
			......................
			{ a.out is stopped and is not printing
			periods at this time }
			% jobs
			[1] + Stopped		a.out
			% kill -HUP %1
			% cat OUT
			......................H.........
			% cat OUT
			......................H......................
			{ a.out has received the SIGHUP, and has
			been restarted }
			% jobs
			[1] + Stopped		a.out
			{ csh doesn't know that the process has been 
			restarted }
			% fg
			^Z
			Stopped
			% kill -QUIT %1
			% cat OUT
			......................H..........................
			% cat OUT
			......................H..........................
			{ a.out has not received the SIGQUIT yet, and has
			not been restarted }
			% fg
			^Z
			% cat OUT
			......................H..........................Q...
			% cat OUT
			......................H..........................Q..........
			{ now a.out has received the SIGQUIT and is running }

Can someone please explain to me in detail why this is so?  I've briefly
searched the source code, but haven't found an explanation.

Please reply by mail, and I'll post satisfactory explanations.
-- 

uucp: ucbvax!ucsbcsl!discolo
arpa: ucsbcsl!discolo at berkeley
csnet: discolo at ucsb
USMail: Computer Systems Lab
	U.C. Santa Barbara
	Santa Barbara, CA  93106
GTE: (805) 961-3221



More information about the Comp.unix.wizards mailing list