Message buffer and printf reentrancy patch

Ian Dowse iedowse at
Sun Jun 15 18:21:46 PDT 2003

In message <20030615.122852.26275397.imp at>, "M. Warner Losh" writes:
>In message: <200306151406.aa36218 at>
>            Ian Dowse <iedowse at> writes:
>: occur via tputchar() when using xconsole, and generally make the
>: use of printf() in the kernel a bit safer. Many of the ideas here
>: were suggested by Bruce Evans.
>Safe enough to be used for ddb?  That is, can we get the ddb output in
>out dmesg buffers?

That's what I use it for anyway - I use a laptop that has no serial
ports but does retain its memory contents across a reboot, so having
panic messages and stack traces left in the message buffer helps a
lot. There are probably a few ways of doing it, but I just replaced
db_putchar()'s contents with the following:

	printf("%c", c);
	if (c == '\r' || c == '\n')

This probably needs to have a sysctl to control the behaviour, as
many people won't want the message buffer to be filled up with
interactive DDB output normally.


More information about the freebsd-arch mailing list