Re: TTY: tty_port questions

Alan Cox
2012-03-25T21:09:30Z

On Sun, 25 Mar 2012 18:20:18 +0100
Al Viro <viro@ZenIV.linux.org.uk> wrote:

> On Sun, Mar 25, 2012 at 05:14:37PM +0200, Richard Weinberger wrote:
> > >> FWIW, uml console in default config is basically "start xterm for each VC".
> > >> What do you suggest to do on vhangup() on one of those?
> > >
> > > What posix says must happen. Which is that the running processes get a
> > > hangup. So a vhangup() would ensure there were no old apps on the UML
> > > guess talking to the xterm (eg stealing login credentials, or abusing
> > > TIOCSTI etc).
>
> IIRC, vhangup(2) is Linux-specific, so I would be surprised if POSIX had
> anything on it...

vhangup causes a carrier drop event equivalent. The rest of the behavior
is POSIX/SUSv3.

> login(1) from util-linux does vhangup(); login(1) from shadow doesn't.

Shadow assumes the getty cleans the channel I believe.

> The thing is, we don't want to do that when port is in use. And we definitely
> don't want somebody to open the damn thing when it's halfway through getting
> set up. I don't see any natural way to do that exclusion with tty_port -
> port->{count,block_open} is protected only by a spinlock and port setup
> we need to do is blocking...

How does this differ from a hardware hotplug ?

Alan