Re: agetty problem after upgrading v2.19.1 -> v2.20.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After reading the following from Andries Brouwer's excellent "The Linux Kernel",
     http://www.win.tue.nl/~aeb/linux/lk/lk-10.html#ss10.3

>
> How does one get a controlling terminal? Nobody knows, this is a great mystery.
>
> The System V approach is that the first tty opened by the process becomes its controlling tty.
>
> The BSD approach is that one has to explicitly call
>
>    ioctl(fd, TIOCSCTTY, ...);
>
> to get a controlling tty.
>
> Linux tries to be compatible with both, as always, and this results in a very obscure complex of conditions. Roughly:
>
> The TIOCSCTTY ioctl will give us a controlling tty, provided that (i) the current process is a session leader, and (ii) it does not yet have a controlling tty, and (iii) maybe the tty should not already control some other session; if it does it is an error if we aren't root, or we steal the tty if we are all-powerful.
>
> Opening some terminal will give us a controlling tty, provided that (i) the current process is a session leader, and (ii) it does not yet have a controlling tty, and (iii) the tty does not already control some other session, and (iv) the open did not have the O_NOCTTY flag, and (v) the tty is not the foreground VT, and (vi) the tty is not the console, and (vii) maybe the tty should not be master or slave pty." 
>

it seems obvious that agetty is always going to fail unless it has already been made a session leader by the caller. Indeed, modifying init to call setsid() before exec'ing agetty makes everything work again.
What's not so obvious to me is whether agetty should always expect this, or become a session leader of it's own accord.

Andrew Walrond
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux