Upon further consideration, since Windows does not support line-buffered mode 
(flush on the occurrence of <newline> in the stream), why do we even bother 
with the setvbuf() call?
Why not let Windows stdio do it's default setup and skip the setvbuf() call?
In other words, how is ' setvbuf(stdout, NULL, _IOLBF, 1024)' advantageous in 
the Windows environment?


>-----Original Message-----
>From: Fab Tillier [mailto:[email protected]]
>Sent: Wednesday, May 25, 2011 1:29 PM
>To: Smith, Stan; Alex Naslednikov; [email protected]
>Cc: Galina Tcharny; OpenSM
>Subject: RE: [ofw] [patch][opensm] Fix for win8 assert
>
>I tried to look up (non-MSDN) documentation for setvbuf, and I can't find 
>anything that would indicate that _IOLBF with a size of zero would
>do anything other than _IONBF (line buffering with a buffer size of zero seems 
>like not buffering, no?)
>
>If you want the default buffers size, why not use BUFSIZ?  That seems like it 
>would achieve actual line buffering, using the default buffer.
>
>-Fab
>
>Smith, Stan wrote on Mon, 23 May 2011 at 11:58:05
>
>> Hello,
>>   What is the logic behind a buffer size of 1024?
>> Since this is shared code (Linux & Windows) the change should be identified
>> as Windows specific; as in
>>
>> #ifdef __WIN__
>>      setvbuf(stdout, NULL, _IOLBF, 1024);
>> #else
>>      /* force stdout to be line-buffered */
>>      setvbuf(stdout, NULL, _IOLBF, 0);
>> #endif
>>
>>> -----Original Message----- From: [email protected]
>>> [mailto:ofw- [email protected]] On Behalf Of Alex
>>> Naslednikov Sent: Sunday, May 22, 2011 4:43 AM To:
>>> [email protected] Cc: Galina Tcharny; OpenSM Subject: [ofw]
>>> [patch][opensm] Fix for win8 assert
>>>
>>> [opensm] fix win8 assert (2<=size<=INT_MAX): setvbuf size param change
>>> from 0 to 1024 Signed-off by: Galina Tcharny (galina at mellanox.co.il)
>>> Index: B:/users/xalex/MLNX_VPI_trunk/ulp/opensm/user/opensm/main.c
>>> ========================================================= ==========
>>> --- B:/users/xalex/MLNX_VPI_trunk/ulp/opensm/user/opensm/main.c
>>>     (revision 8023) +++
>>> B:/users/xalex/MLNX_VPI_trunk/ulp/opensm/user/opensm/main.c         
>>> (revision
>>> 8024) @@ -692,7 +692,7 @@   };
>>>
>>>     /* force stdout to be line-buffered */
>>> -   setvbuf(stdout, NULL, _IOLBF, 0);
>>> +   setvbuf(stdout, NULL, _IOLBF, 1024);
>>>
>>>     /* Make sure that the opensm and complib were compiled using
>>>        same modes (debug/free) */
>>>
>>> Alexander (XaleX) Naslednikov
>>> SW Networking Team
>>> Mellanox Technologies
>>>
>>>
>>> _______________________________________________
>>> ofw mailing list
>>> [email protected]
>>> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
>> _______________________________________________
>> ofw mailing list
>> [email protected]
>> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to