Path: utzoo!attcan!sobmips!roe From: roe@sobmips.UUCP (r.peterson) Newsgroups: comp.unix.questions Subject: Re: logging out a terminal Message-ID: <1989Oct25.043848.28827@sobmips.UUCP> Date: 25 Oct 89 04:38:48 GMT References: <1001@quack.UUCP> Organization: Sobeco Group - Montreal, Canada Lines: 35 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