[lkml]   [2010]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: tty: add 'active' sysfs attribute to tty0 and console device
On Thu, Nov 18, 2010 at 02:41:23PM +0000, Alan Cox wrote:
> > How can I detect the major and minor of the primary console device
> > of /dev/console without controlling tty? Even if my old blogd
> In the general case you can't - because a console may not have a tty.
> Quite a few don't. For the cases where one has a device I can't see a
> clean way to do it as an fstat on the console device will give you the
> console major/mninor and some code depends upon that.

ACK ... nevertheless sometime it could be very useful to be able to
debug the user space boot process on e.g. big irons aka mainframes.

> The iniability to get it is clearly a flaw and you need the sysfs link or
> a sysfs list of consoles (again remembering many of them won't have a tty
> bound).

Even with this case and IMHO a copy of all system console messages
would be sometimes useful for debugging.

> > and the bootlogd(8) of SysInitV using TIOCCONS are outdated by SystemD
> > the question before doing the TIOCCONS is which is the primary console
> > device to e.g. create the device node in initrd or for bootlogd(8)
> > to write a copy of the console messages back to the original
> > primary console (and the other console devices).
> For init it is /dev/console as opened at boot time and passed to the
> initial user init task but with no nice way to work back to a device node.

Currently the bootlogd(8) or blogd(8) parse the kernels command line
and if available do an ioctl TIOCGDEV (not supported by the upstream
kernel), then create a pty/tty pair, do an ioctl TIOCCONS to forward
the system console to the created tty, now both daemons can parse
all console messages to write out logs and write all copies to the
former devices node(s) (compare with

> Incidentally the primary console (as in printk) can be accessed as a tty
> via the ttyprintk driver which got added recently because embedded people
> wanted to use the printk interface as a (write only) tty console as well.

I've seen that in the changelog of the kernel ... maybe this would
a good replacment for the /dev/kmsg redirect of stdout/stderr in initrd.


System V style init programs -

 \ /
  Last update: 2010-11-19 14:25    [W:0.061 / U:2.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site