stdio on SYSV vrs BSD

Guy Harris guy at auspex.auspex.com
Thu May 3 07:25:44 AEST 1990


>>       What is the equivalent on SYSV machines?
>
>I hope to God there isn't one.

Uhh, System V's hack is worse; it sets the file descriptor number for a
"this is really a string" stream to _NFILE, and it *does* do some
special-casing in "_doscan".

The problem with this is that it *hard-codes* the idea that _NFILE is
the number of file descriptors into standard I/O, which sucks because
the maximum number of file descriptors is tunable in later S5 releases. 
Choosing some far out-of-range value such as 255 on unsigned-char
machines and -1 on signed-char machines would have been preferable....

(Yes, I know that S5's standard I/O has a fixed number of "_iob"
entries, and thus couldn't use the extra descriptors anyway.  This is
*not* a valid excuse; 4.3BSD's standard I/O dynamically allocates the
"_iob" stuff, and those techniques could be applied to S5's as well -
definitely so if binary compatibility isn't a concern, and it may be
possible even if it *is* a concern.)



More information about the Comp.unix.wizards mailing list