Getting 'getty' to hangup dialup lines.

dbj at RICE.ARPA dbj at RICE.ARPA
Thu Aug 16 15:04:03 AEST 1984


From:  Dave Johnson <dbj at RICE.ARPA>

	I added the line
		ioctl(0,TIOCHPCL,0);
	to getty.c to cause dialup lines to hangup when a user logs out.

	For some unknown reason that does not work all of the time.  Does
	anybody have any idea why?

The reason that this doesn't work some times is that the device close
routine (which is responsible for actually dropping DTR after you've done a
TIOCHPCL) does not get called by the kernel until the last file descriptor
is closed to that device.  If there are processes running in the background
on that terminal when you log off, they will most likely still have files
open to the terminal, and thus the device close routine does not get called
and the line does not get hung up.  Alas, vhangup() does not dissassociate
the background processes from the terminal enough to convice the rest of the
kernel to call the device close routine or to call it itself to get the
hang up effect.

Currently, the only real way to fix this would be to carefully run
background processes with their standard input, output and error redirected
somewhere other than the terminal, such as to /dev/null with

        process </dev/null >&/dev/null &

                                        Dave Johnson
                                        Dept. of Computer Science
                                        Rice University
                                        dbj at rice.ARPA



More information about the Comp.unix.wizards mailing list