Re: [hackers] [sbase] [PATCH 04/11] Don't use buffered IO (fread) when not appropriate

From: Laslo Hunhold <>
Date: Tue, 27 Dec 2016 14:36:42 +0100

On Tue, 6 Dec 2016 02:16:56 -0800
Michael Forney <> wrote:

Hey Michael,

> fread reads the entire requested size (BUFSIZ), which causes tools to
> block if only small amounts of data are available at a time. At best,
> this causes unnecessary copies and inefficiency, at worst, tools like
> tee and cat are almost unusable in some cases since they only display
> large chunks of data at a time.

sbase uses FILE-pointers exclusively and mixing both "logics" is not
very helpful for the clarity of the expressed code.
The writeall() function looks like an util function that could be
introduced to completely convert sbase from fp to fd stream handling.

I think this is not the place here to discuss this, but I would be glad
if you could create a new thread here on hackers_AT_ where you give some
examples where buffered IO is problematic.
The necessity to add functions like fshut() really made me think twice
about the advantages of buffered IO.



Laslo Hunhold <>
Received on Tue Dec 27 2016 - 14:36:42 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 27 2016 - 15:16:14 CET