I have a bootlogd that does a TIOCCONS on /dev/console, so
that it can capture all messages written to /dev/console.
It buffers the messages in-memory, until it is able to open
a logfile in /var/log/ at which point it writes the buffered
data to the logfile, and starts logging to that file.
The only problem is that TIOCCONS is a redirect, so there's no
output to the console anymore. Ofcourse that can be solved by
letting bootlogd open("/dev/realconsole") and sending a copy
to it, but there is no way to ask the kernel to which _real_
device /dev/console is connected.
I submitted a TIOCGDEV ioctl patch a few times during 2.2 development
but it was never integrated, alas.
So this is all solveable in userspace. No need to buffer
messages in non-swappable memory in the the kernel.
Simply add TIOCGDEV or add a flags to the TIOCCONS ioctl that
means 'copy instead of redirect'. Both are useful .. Or, hmm,
interesting, add some code so that if you write to the master
side of the pty pair to which the console is redirected, the
output ends up on the real console. That has a nice symmetric
feel to it.
Sample code is in sysvinit since 2.79 or 2.80, sysvinit-2.xx/src/bootlogd.c
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to email@example.com
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/