ultrix 2.0 _iob storage
Jon Wells
jon at jim.odr.oz
Wed Oct 5 17:17:12 AEST 1988
G'day,
Just wondering how _iob in declared in real unix systems
(ones that dec hasn't got at).
I found a piece of code in Kyoto Common Lisp which does....
..
nfiles = getdtablesize();
for ( p = &_iob[3]; p < _iob[nfiles]; p++ )
fclose(p);
..
Eg. charges though _iob trying to close any stream that's open
(apart from stdin/stdout/stderr).
You can't do this with ultrix (2.0) as _iob is only 3 slots long, all
other struct _iobuf's are allocated dynamically so &_iob[3]....
just points off into the weeds.
Is the above code deemed to be a reasonable way of doing this?
Ultrix provides a function called _fwalk() which, given a pointer to a
function, will call that function for every open stream passing it the
FILE *.
It's totally undocumented, I grep'd through every manual entry looking
for it (I found it by tracing exit(), it's name looked interresting in
nm's output).
Is _fwalk() standard on other genders of unix???
Does every one else store all the _iobuf's in _iob as one array?
Is this another dec knows best????
Or is there a much better way of closing everything but stdin etc.????
jon
--
More information about the Comp.unix.wizards
mailing list