Sub-optimal libc's read-ahead buffering behaviour

Andrey Chernov ache at FreeBSD.ORG
Thu Aug 4 06:39:14 GMT 2005


On Thu, Aug 04, 2005 at 10:02:51AM +0400, Andrey Chernov wrote:
> But between read & seek character device itself can move its pointer in 
> anyplace.

Well, this phrase is incorrectly constructed. I mean: by reading 
from the character device, the pointer can be moved to same unpredictable 
places, say, become negative, or other overflow happens.

So (considering changing content like /dev/mem too), any buferization is 
potentially dangerous here. fseek traditionally used as buferization 
break, in case, say, between fread and fwrite. In case SEEK_CUR still uses 
the buffer, it probably should not for character device.

-- 
http://ache.pp.ru/


More information about the freebsd-current mailing list