setvbuf() broken under SCO Xenix?

Earl H. Kinmonth ked at garnet.berkeley.edu
Tue Mar 14 15:07:46 AEST 1989


Several weeks ago, I posted a note to the effect that SCO Xenix
setvbuf is screwed up compared to more common setvbuf versions
because of the different calling conventions:

setvbuf(stream,buf,type,size)	/* common */

setvbuf(stream,type,buf,size)	/* sco */

I thought fixing this would correct some problems I had noted
with programs converted from 4.3 BSD or even MiSerable DOS.  This
has not been the case.  I've noted several instances of weird bugs
when using setvbuf() with SCO Xenix (the same programs run fine with
MiSerable DOS and 4.3 BSD).  They also run fine under SCO Xenix IF
setvbuf is commented out of the code. Specifically:

(a)
buf = malloc(size);
setvbuf(stream,type,buf,size);
stream->_flag & _IOMYBUF shows that _IOMYBUF is not set.

(b)
measured performance with sequential access (getc()) on large files
shows no improvement, even a degradation with size > BUFSIZ!  This
is disturbing, since MiSerable DOS and 4.3 BSD show improved performance
(elapsed time, number of calls to read()) with larger buffer sizes.

This suggests to me that not only is the parameter sequence for
setvbuf() assbackwards, but the actual realization of the function
is broken.

Note, to detect this, you must use prof and/or look at the times needed
to read/write a file.  Bad calls to setvbuf() apparently do no harm,
and the first io operation on stream gives you default buffering, so
unless you are making cross comparisons between systems, you probably
will see no problems.



More information about the Comp.unix.xenix mailing list