Autologout of unused terminals
Guy Harris
guy at auspex.UUCP
Tue Dec 6 07:09:59 AEST 1988
>It does have a problem, perhaps someone can elaborate on, it logs the
>user off, but keeps the carrier on, so the line is useless anyways.
>Is there some way to force the carrier to be dropped on a KILL -HUP?
>
>(sun 3, ALM, port configured for modem, DTR dropping will hang up, but
>kill -HUP doesn't seem to do it).
At least under SunOS 4.0 (and quite possibly under earlier releases),
the default behavior is supposed to be that carrier is dropped when the
last process that has the terminal open closes it.
It may be that:
1) the line is configured for this not to happen (see the "hc"
option in GETTYTAB(5));
2) the "hangup on last close" flag isn't getting set for some
other reason;
3) the ALM driver doesn't handle this flag correctly;
4) "kill -HUP" isn't killing off *all* the processes on that
terminal, so one of them is still holding the line open.
Presumably, you've checked this (some process might ignore
SIGHUP, or catch it and either not exit at all or take a long
time to exit).
If you're running 4.0, the "hangup on last close" flag is accessible to
"stty"; try dialing in (so you don't screw some unlucky user while
testing) and then do
stty -a >(the terminal)
and see if "hupcl" (the "hangup on last close" flag) is set or not. If
it says "-hupcl", it's not set. Try doing
stty hupcl >(the terminal)
and then provoke your script into blasting you off and see what happens.
If you're running a release before 4.0, the flag can be set, but it
cannot be cleared nor can its state be found easily. Try running this
small program with its output redirected to the terminal in question:
#include <sys/ioctl.h>
main()
{
if (ioctl(1, TIOCHPCL, 0) < 0)
perror("TIOCHPCL");
}
and then run the script (or some version modified to just go ahead and
blast just you, but to do so immediately) and see what happens.
More information about the Comp.unix.wizards
mailing list