kern/110017: [libexec] [patch] serial port console output garbled

Heath N. Caldwell hcaldwell at fastsoft.com
Wed Sep 15 22:10:03 UTC 2010


The following reply was made to PR kern/110017; it has been noted by GNATS.

From: "Heath N. Caldwell" <hcaldwell at fastsoft.com>
To: bug-followup at FreeBSD.org, dan at more.net
Cc: Ji Li <jli at fastsoft.com>
Subject: Re: kern/110017: [libexec] [patch] serial port console output
 garbled
Date: Wed, 15 Sep 2010 14:49:44 -0700

 We ran into this same problem with the PowerEdge 1950 and PowerEdge
 R710.
 
 I spent some time looking at the problem, and it looks like what is
 happening is that oflush() is called right before a case that will end
 up continuing back to the top of the loop, at which time setttymode()
 gets called, which calls tcflush() right off the bat (with TCIOFLUSH).
 So the buffered data is sent, but for at least these machines, it
 doesn't get a chance to be completely written before the call to
 tcflush(), causing it to get into a garbled state.
 
 Here is a patch that uses tcdrain() to make sure that the data is
 completely written to the terminal before returning from oflush().  I
 think that this addresses the problem more directly.
 
 --- getty/main.c	(revision 212627)
 +++ getty/main.c	(working copy)
 @@ -689,8 +689,10 @@
  static void
  oflush(void)
  {
 -	if (obufcnt)
 +	if (obufcnt) {
  		write(STDOUT_FILENO, outbuf, obufcnt);
 +		tcdrain(STDOUT_FILENO);
 +	}
  	obufcnt = 0;
  }
  
 -- 
 Heath Caldwell
 hncaldwell at fastsoft.com


More information about the freebsd-bugs mailing list