Path: utzoo!attcan!uunet!munnari!bruce!goanna!yabbie!koel!cit5!olympic!jim!jon From: jon@jim.odr.oz (Jon Wells) Newsgroups: comp.unix.wizards Subject: ultrix 2.0 _iob storage Keywords: ultrix stdio _iob _fwalk() Message-ID: <566@jim.odr.oz> Date: 5 Oct 88 07:17:12 GMT Organization: O'Dowd Research Pty. Ltd., Melbourne, Australia. Lines: 37 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 --