Re: tty: add 'active' sysfs attribute to tty0 and console device

From: Kay Sievers
Date: Tue Nov 16 2010 - 11:13:29 EST


On Tue, Nov 16, 2010 at 16:57, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, 16 Nov 2010 16:46:40 +0100
> Kay Sievers <kay.sievers@xxxxxxxx> wrote:
>
>> commit be0d5f02c9194fe41c1aad11d7282db117bda938
>> Author: Kay Sievers <kay.sievers@xxxxxxxx>
>> Date: Â Tue Nov 9 18:53:59 2010 +0100
>>
>> Â Â tty: add 'active' sysfs attribute to tty0 and console device
>
> This is all somewhat weird.
>
>> Â Â Userspace can query the actual virtual console, and the configured
>> Â Â console devices behind /dev/tt0 and /dev/console.
>
> All the other vt interface code is in the vt driver, the ioctls for it
> are in the vt driver and a query about what is the active vt only has
> meaning within that context as you need to post a waitevent first to
> track changes during the query. So if you need a VT_GETACTIVE interface
> put it in the tty ioctls where it can be properly locked and used.
>
>> +What: Â Â Â Â Â Â Â Â/sys/class/tty/tty0/active
>> +Date: Â Â Â Â Â Â Â ÂNov 2010
>> +Contact: Â Â Kay Sievers <kay.sievers@xxxxxxxx>
>> +Description:
>> + Â Â Â Â Â Â ÂShows the currently active virtual console
>> + Â Â Â Â Â Â Âdevice, like 'tty1'.
>> + Â Â Â Â Â Â ÂThe file supports poll() to detect virtual
>> + Â Â Â Â Â Â Âconsole switches.
>
> NAK this, its a nonsense interface
>
> Seriously what use is an interface that tells you "what the console might
> have been", this is why we have a proper event tracking interface instead.

You mean the VT_WAITEVENT? Sleeping ioctls() can't be used. The time
between the check for the current, and you go to sleep in the ioctl()
for teh next is a window which isn't covered with such interface.

And 'might have been' does not matter, it's fine. We just need change
notification, and can query the actual vt again.

Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/