🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.linux
Article #57661

Signals in Linux

#57661
From: Douglas Garstang
Date: Tue, 03 Sep 1996 00:00
51 lines
2174 bytes

	I am running Linux and I am trying to compile some C code under
	GNU C.

	It involves unix SIGNALS. I have two processes, and I am trying
	to trap a signal sent from one process to another.

	I have the following code in my main program....

	signal(SIGUSR1,dump);

	and dump is as follows....

	void dump(void)
	{	printf("SIGNAL RECEIVED");
		signal(SIGUSR1,dump);
	}

	and I send the signal from the other process with....

	kill(pid,SIGUSR1);

	Now.. I thought I could use kill to sed general purpose signals
	and I thought the above code would capture the signal, run the
	handler dump() and then continue on. It seems to capture the signal
	BUT the program then stops..... Why?

	I've already posted this query to comp.lang.c and someone there told
	me that I should not have library functions in the handler dump().
	He said that in fact I need to get the handler to return a value back
	to the main program. Thats a bit silly isnt it? How could I do that?
	The program doesnt have an exit and entry point like a normal 
	function. He mentioned using a return variable sig_atomic_t too.

	So does anyone know how I can get the program to continue on AFTER
	capturing the signal...?

	Thanks. replies to rainbow@zip.com.au



-- 
----------------------------------------------------------------------
|\/\/\/| Douglas Garstang AKA Automan    B.Bus(Comp)  _--_|\
|      | 6 Bellinger Road Ruse Campbelltown NSW 2560 /      \
(o)(o) | rainbow@zip.com.au      Mobile# 017 815 606 \_.--._/<-- Here!
|c     ) doug.garstang@telecom.telememo.au                 v
 \--  |  -------------------------------------------------------------       
  \   |  I'm so hip I can't see over my own pelvis!  
   -------------------------------------------------------------------
Technical Details
Message-ID: <50gsgb$ug0@the-fly.zip.com.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 102983,60edc396c1228b7e,start
X-Google-Attributes: gid102983,public
From: rainbow@zip.com.au (Douglas Garstang)
Subject: Signals in Linux
Date: 1996/09/03
Message-ID: <50gsgb$ug0@the-fly.zip.com.au>
X-Deja-AN: 178149127
organization: Zip Australia Pty Ltd
newsgroups: aus.computers.linux