[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: controlling stdio buffering
From: |
Pádraig Brady |
Subject: |
Re: controlling stdio buffering |
Date: |
Wed, 22 Mar 2006 13:56:46 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.7 (X11/20051013) |
Andreas Schwab wrote:
>Pádraig Brady <address@hidden> writes:
>
>
>
>>It's just that above call seems to have no affect,
>>
>>
>
>The standard does not require that setvbuf has any visible effect apart
>from honoring the buffering mode.
>
> 7.19.5.6 The setvbuf function
>
> ... If buf is not a null pointer, the array it points to may be used
> instead of a buffer allocated by the setvbuf function and the argument
> size specifies the size of the array; otherwise, size may determine
> the size of a buffer allocated by the setvbuf function. ...
>
>Note the use of "may" instead of "shall".
>
>
Yes the "size may determine the size of a buffer allocated by the
setvbuf function".
But glibc does not do this and hence should report non 0 to say it's not
honoured.
If the platform does support internal buffer allocation, then that could
fail also
resulting in a non 0 return. In either case the application will want to
know if
it got the requested buffer size or not.
I'm also confused about the default buffer sizes.
On my libc6-2.3.5-1ubuntu1 stdin buffer defaults to 4096, stdout to 1024
and BUFSIZ is 8192 ?
cheers,
Pádraig.