Registering additional console from a module?

David Woodhouse (
Thu, 08 May 1997 17:28:42 +0100

For some time, I've been using an old MDA monitor to display my syslog. I have
decided it's about time to make it a console, so that any kernel panic
messages will get sent to it, because they usually end up behind my X display,
which isn't particularly useful.

As the mda driver is currently a module, I'd like to keep it that way, but I
have a few doubts about registering the new console from a module.

Looking at the implementation of register_console in kernel/printk.c, I
see that the new console would be added at the head of the linked list.
Can I happily add an unregister_console function, to cut the new console
entry out of the linked list when the module is unloaded?

As these functions could then be called at any time, I suppose I would
need to protect the linked list with a spinlock to prevent concurrent
modifications, which could leave the linked list corrupted. What routines are
offered by the kernel for this? (2.1.37)

I did think about the possibility of adding a routine to allow dynamic setting
of consoles via a file in /proc, e.g. echo "add /dev/mono" >/proc/consoles to
do it, but this wouldn't be so simple, would it? Maybe it could be done if we
only allow character devices to be used?

Any ideas / suggestions?

---- ------------------------------------------------ ----
David Woodhouse, WWW:
Robinson College, Email:
Cambridge, Tel: +44 (0) 976 658355
CB3 9AN, (n)talk:
England. PGP KEY: finger
---- ------------------------------------------------ ----