Xref: utzoo comp.unix.questions:28606 comp.unix.internals:2017 comp.unix.wizards:24062 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!cme!cam!coleman From: coleman@cam.nist.gov (Sean Sheridan Coleman X5672) Newsgroups: comp.unix.questions,comp.unix.internals,comp.unix.wizards Subject: SIGCONT occurs after a SIGTERM Message-ID: <7103@fs1.cam.nist.gov> Date: 11 Feb 91 17:06:07 GMT Organization: National Institute of Standards & Technology, Gaithersburg, MD Lines: 86 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. % net l logfile ^Z Signal caught is 18 Stopped (signal) % jobs [1] + Stopped (signal) net l logfile % 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. % !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 coleman@bldrdoc.gov NIST Boulder, CO