mrapple@quack.UUCP (Nick Sayer) (10/20/89)
This is on a Momentum Hawk 32 running Unisoft V7 Unix circa 1983. I am (re-)writing an idle daemon for this beast, and am running into trouble. The original code I'm hacking to bits calls for a routine "vhangup()." How can I write this routine? Note that through experimentation, I've discovered that killing the login shell will NOT terminate sub-shells for some reason. Also, the local csh does not seem to respond to SIGHUP, SIGTERM or SIGINT. It IS, however, responding to such things as SIGFPE, SIGALRM, and other silly things. Do I have to search through the process table looking for all processes running on a certain terminal and send them SIGKILL? That seems a bit draconian. --------------------------------------------------------------------- Nick Sayer | ...{ lll-winken!cheers ucdavis!uop } !quack!mrapple .... or.... cheers!quack!mrapple@apple.com or quack!mrapple@uop.edu Packet radio: N6QQQ @ WB6V | FredMail: NSAYER@MADERA%NORCAL Disclaimer: The BBC would like to appologise for that announcement
roe@sobmips.UUCP (r.peterson) (10/25/89)
From article <1001@quack.UUCP>, by mrapple@quack.UUCP (Nick Sayer): > I am (re-)writing an idle daemon for this beast, and am running > into trouble. The original code I'm hacking to bits calls for > a routine "vhangup()." How can I write this routine? > > Do I have to search through the process table looking for all processes > running on a certain terminal and send them SIGKILL? That seems > a bit draconian. > Depends on what version of kill(2) you've got. I can't remember if V7 (especially unisoft) supports this, but -- according to the sysV man(2)kill: - kill(pid,sig) - [stuff deleted] - - If pid is negative but not -1, sig will be sent to all - processes whose process group ID is equal to the absolute - value of pid. So, the trick is finding the login-spawned shell process (ie the process group leader) associated with the set of jobs you want to kill. (Look for a ksh,csh,sh with PPID=1). Given that, just negate that jobs' process id (it will almost always be the process group leader for the entire login session), and try kill(-pid,9) to terminate all processes associated with that terminal with extreme prejudice. Good luck. -- If the brain were so simple we understood it|Roe Peterson We would be so simple we couldn't. |{attcan,mcgill-vision}!sobeco!roe