Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 Aug 1997 18:22:34 +0100
From:      Brian Somers <brian@awfulhak.org>
To:        Charles Henrich <henrich@crh.cl.msu.edu>
Cc:        Michael Smith <msmith@atrad.adelaide.edu.au>, tom@sdf.com, freebsd-hackers@FreeBSD.ORG
Subject:   Re: tty-level buffer overflows 
Message-ID:  <199708031722.SAA19779@awfulhak.org>
In-Reply-To: Your message of "Sun, 03 Aug 1997 11:21:47 EDT." <19970803112147.21483@crh.cl.msu.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
> > Your application is busted; data is arriving faster than your app is reading
> > it, and the kernel has run out of patience and started throwing the data
> > away.
> 
> Im afraid not, the application is a software Upload, with a singly byte ack
> every 2k, if the serial port cant handle that, theres a problem.  I would
> presume that if the buffer is full, a write() should block.  

It's not a case of the serial port handling it.  As the OS receives 
data from the com port, it buffers it 'till your application does a 
read().  If your application isn't read()ing as fast as the data is 
arriving, the kernel buffers will fill.  When they're full, the sio 
driver can't do anything with the incoming data, so it doesn't bother 
reading the port.  When your app eventually read()s, some buffers are 
emptied and the kernel goes off and reads the receive buffer of the 
UART.  It notices that the overflow bit is set, and emmits the sio 
overflow message.

If your application really needs to run slower than the data that's 
being given to it, you'll need to design around it.

> -Crh
> 
>        Charles Henrich     Michigan State University     henrich@msu.edu
> 
>                          http://pilot.msu.edu/~henrich

-- 
Brian <brian@awfulhak.org>, <brian@freebsd.org>
      <http://www.awfulhak.org>;
Don't _EVER_ lose your sense of humour....





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