Sub-optimal libc's read-ahead buffering behaviour

Andrey Chernov ache at FreeBSD.ORG
Thu Aug 4 06:03:02 GMT 2005

On Wed, Aug 03, 2005 at 06:58:42PM +0300, Maxim Sobolev wrote:
> Checking the actual code confirm your point, thank you! However, I think 
> that the current behaviour is at best inconsistent, since it in fact 
> does buffering of character devices in some cases but does not in some 
> others. In my example it reads 4096 bytes instead of requested 512 at 
> each request, but when the program does fseek it rejects part of that 
> buffer and does re-positioning and re-reading. Very confusing behaviour 

No surprize. Single read can be consider as sort of "atomic" operation.
But between read & seek character device itself can move its pointer in 


More information about the freebsd-current mailing list