🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #6866

SIGCONT appears after a SIGTERM

#6866
From: Sean Sheridan Coleman X5672
Date: Mon, 18 Feb 1991 18:43
72 lines
2535 bytes
Please explain to me why a SIGCONT is sent to a process after SIGTERM is
sent to my process. It doesn't compute because TERM means to terminate the
the process. I catch SIGCONT because I do some reconnecting for serial
drivers after my process is stopped from a cntl-Z. Below is a piece of the
code and a some output from the program. 

Here I stop the program with a ^Z and restart using fg %1.  SIGCONT is
sent in this situation correctly.

<deputy /home/central/coleman/real_prog/net.dir/net_log> % net l logfile
^Z Signal caught is 18

Stopped (signal)
<deputy /home/central/coleman/real_prog/net.dir/net_log> % jobs
[1]  + Stopped (signal)     net l logfile
<deputy /home/central/coleman/real_prog/net.dir/net_log> % fg %1
net l logfile
 Signal caught is 19
^C Signal caught is 2

From another window, I used kill -TERM  to kill this process.  SIGTERM is
received first but then SIGCONT is sent for no known reason.

<deputy /home/central/coleman/real_prog/net.dir/net_log> % !ne
net l logfile
 Signal caught is 15
 Signal caught is 19
No devices are available to use for logging

Here is the signal handler:

Note: device,device_file and device_name are global

sig_handler(sig)
int sig;
{
	extern int      device;
	extern FILE    *device_file;
	extern char    *device_name;
	char           *strip_add_dev_name();

	printf(" Signal caught is %d\n", sig);
	switch (sig) {
	case SIGINT:
	case SIGTERM:
		unlock_dev(strip_add_dev_name(ttyname(device), 0));
		exit(1);
	case SIGTSTP:
		unlock_dev(strip_add_dev_name(ttyname(device), 0));
		close(device);
		kill(0, SIGSTOP);
		break;
	case SIGCONT:
		if (device_file != NULL) {
			rewind(device_file);
			device = get_device(device_file);
		} else {
			if ((device = chk_device(device_name)) < 0) {
				printf("No devices are available to use for logging\n");
				exit(1);
			}
		}

	default:
		break;

	}
}


Thanks
Sean Coleman
Technical Details
Message-ID: <1677@brchh104.bnr.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request
From: coleman@local.cam.nist.gov (Sean Sheridan Coleman X5672)
Newsgroups: comp.sys.sun
Subject: SIGCONT appears after a SIGTERM
Keywords: Miscellaneous
Message-ID: <1677@brchh104.bnr.ca>
Date: 18 Feb 91 18:43:00 GMT
Sender: news@brchh104.bnr.ca
Organization: Sun-Spots
Lines: 72
Approved: Sun-Spots@rice.edu
X-Original-Date: 11 Feb 91 17:07:21 GMT
X-Sun-Spots-Digest: Volume 10, Issue 41, message 8
X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu