Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Dec 2008 21:48:05 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r185891 - head/sys/kern
Message-ID:  <200812102148.mBALm5Lt044021@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812102148.mBALm5Lt044021>