svn commit: r185891 - head/sys/kern
Ed Schouten
ed at FreeBSD.org
Wed Dec 10 13:48:05 PST 2008
Author: ed
Date: Wed Dec 10 21:48:05 2008
New Revision: 185891
URL: http://svn.freebsd.org/changeset/base/185891
Log:
Remove added newlines from logged messages written to /dev/console.
The /dev/console device node logs all strings that are written to it.
When the string does not contain a trailing newline, it appends one. I
can imagine this was useful a long time ago, but with our current
rc-scripts, it generates a whole bunch of messages that look like:
| Configuring syscons:
| blanktime
| .
By not appending the newlines, the output of `dmesg -a' is now (almost?)
exactly the same as what the user will see on the console device
(syscons, uart).
Modified:
head/sys/kern/subr_prf.c
Modified: head/sys/kern/subr_prf.c
==============================================================================
--- head/sys/kern/subr_prf.c Wed Dec 10 21:32:58 2008 (r185890)
+++ head/sys/kern/subr_prf.c Wed Dec 10 21:48:05 2008 (r185891)
@@ -257,7 +257,7 @@ log(int level, const char *fmt, ...)
void
log_console(struct uio *uio)
{
- int c, i, error, nl;
+ int c, i, error;
char *consbuffer;
int pri;
@@ -268,22 +268,14 @@ log_console(struct uio *uio)
uio = cloneuio(uio);
consbuffer = malloc(CONSCHUNK, M_TEMP, M_WAITOK);
- nl = 0;
while (uio->uio_resid > 0) {
c = imin(uio->uio_resid, CONSCHUNK);
error = uiomove(consbuffer, c, uio);
if (error != 0)
break;
- for (i = 0; i < c; i++) {
+ for (i = 0; i < c; i++)
msglogchar(consbuffer[i], pri);
- if (consbuffer[i] == '\n')
- nl = 1;
- else
- nl = 0;
- }
}
- if (!nl)
- msglogchar('\n', pri);
msgbuftrigger = 1;
free(uio, M_IOV);
free(consbuffer, M_TEMP);
More information about the svn-src-head
mailing list