tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: stdio buffering extension



On Tue, Jul 14, 2015 at 04:21:13PM -0400, Christos Zoulas wrote:
> 
> Hi,
> 
> After discussing importing stdbuf(1) from FreeBSD with various
> people, they objected about it using LD_PRELOAD and suggested to
> use the environment directly to alter the default buffering policy.
> 
> Here's an implementation of that...
...
> +Input and output against the opened stream will be fully buffered, unless
> +it refers to an interactive terminal device, or a different kind of buffering
> +is specified in the environment.

The one I want most is line buffering to pipes.
You almost want to force it from the reading end (eg in tee).
The other common case is when stdout and stderr refer to the
same file - when you probably want line buffering for stdout.

OTOH if a program is writing binary data (maybe using fwrite()
not fprintf()) then block buffering is more likely to be
appropriate.

How much scope does the standard give for more intelligent
choices?

	David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index