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

From: Kay Sievers
Date: Thu Nov 18 2010 - 07:04:23 EST


On 2010-11-18, Dr. Werner Fink <werner@xxxxxxx> wrote:
> On Wed, Nov 17, 2010 at 05:53:10PM -0800, Greg KH wrote:
>> On Thu, Nov 18, 2010 at 02:48:48AM +0100, Lennart Poettering wrote:
>> > On Wed, 17.11.10 17:27, Greg KH (greg@xxxxxxxxx) wrote:
>> >
>> > > I can do any one, or multiple things from the following options:
>> > >
>> > > - disable the existing ioctl to return an error so that no new
>> > > userspace program starts to use it thinking it is valid
>> > > - accept Werner's patch for those who like proc files
>> > > - accept Kay's patch
>> > >
>> > > Any suggestions?
>> >
>> > Maybe this is not so surprising, but I definitely want item #3 from the
>> > list.
>> >
>> > I am against #2, since #1 is a much nicer solution, and having both
>> > would be needlessly redundant.
>>
>> I think you mean s/1/3/ here, right?
>>
>> And yes, having both will be redundant, and Werner seems to not be
>> responding anymore as to why he feels his patch is somehow still needed
>> given that Kay's patch accomplishes the same thing from what I can tell.
>
> I'm still reading and I'm wondering about this discussion. The only
> thing I'd like to be able is to detect all ttys used for the system
> console even if not a VT (not having a VT but several other consoles
> is the most pressing case e.g. on s390 or zSeries) and this without
> forcing (and maybe stealing) the controlling tty on the system console
> to be able to detect the primary tty/console.
>
> The primary tty marked with CON_CONSDEV and normally the first in
> console_drivers. This can be done with Kay's patch as well as with
> my approach. And both approaches do have the advantage to become
> the full list of consoles which will help me to extend e.g. sulogin ...
>
> The only advantage of my approache in comparision to Kay's one is that
> the remaining console flags become visible for normal user space.
> This was an idea of Randy Dunlap otherwise my patch would provide
> the same information as the patch of Kay.
>
> Maybe Kay could extend his patch in that way that the flags and the
> facilities (having device, read, write, and unblank) are also shown
> in the new file /sys/class/tty/console/active ... but maybe Randy
> could says a few words for what this is usable.

I'm pretty sure such flags, if they are meant to be exported to
userspace (which I have no good idea about) belong to the individual
devices, and not in the 'active' file.

We surely can do that, if that fits into the general picture. You
could poll(console/active) for changes, get the list of devices, and
look at them individually. poll() will tell you when you dynamically
need to adapt your service.

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/