Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 5/3/83; site ukc.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!houxz!vax135!ukc!pc From: pc@ukc.UUCP (R.P.A.Collinson) Newsgroups: net.unix-wizards Subject: Re: Hangups about vhangup() Message-ID: <4346@ukc.UUCP> Date: Sat, 11-Aug-84 08:27:25 EDT Article-I.D.: ukc.4346 Posted: Sat Aug 11 08:27:25 1984 Date-Received: Thu, 9-Aug-84 04:47:23 EDT Organization: Computing Lab. Kent University, England Lines: 51 The vhangup problem discussed by Joe Kelsey and also the getty/dialup problem are related. One fundamental problem with the vhangup call is that it takes a file descriptor and not a device name. This means that the terminal has to be opened, vhangup'ed and then closed. This means that the act of opening the device may foul up reference counts on inodes etc etc. I also suspect that there is a fundamental problem in the fact that inodes for terminals are never locked so that UNIX can scribble when you are inputting, there are occasional race problems with the close code. The terminals on our systems are connected via a network and we want all terminals to detach cleanly from a machine on logout. The problem is to do this in a benign way, not killing everything which a user has carefully left running in the background. I have had various attempts at this, and the current scheme is as follows: 1) Invent a new system call (yes YET ANOTHER one) called hangtty(dev) char *dev; The dev argument is used to obtain an pointer to the incore inode for the terminal. 2) Set a flag in this inode IDEAD (UCB thoughtfully left a few spare bits) call the terminal close routine. We must now make sure that any further action on the inode does not get through to the device. 3) A write/read to an IDEAD inode results in a SIGKILL being sent to the offending process. The user has no business leaving a background process running which writes or reads when the user has gone away. 4) The call to get a new inode for the terminal (iget) ignores any inodes with IDEAD bits. So for short periods, there is more than one inode referring to the terminal. One is live, all the others have the IDEAD bit set. This scheme appears to work, and is in use at mcvax. I believe that certain ex-UCB people don't like it because it cuts across the layering in the kernel. But still..... (On the UCB/System V discussion, Bill Joy did us all a disservice in csh when he allowed people to leave background jobs running without having said nohup). Peter Collinson University of Kent, UK vax135!ukc!pc mcvax!ukc!pc