Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!apple!bionet!uwmcsd1!marque!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: <575@jim.odr.oz> Date: 23 Oct 88 23:08:33 GMT Organization: O'Dowd Research Pty. Ltd., Melbourne, Australia. Lines: 48 [attempt two, sorry if you've seen this before, I may have messed up the posting, anyway, I didn't get any response and I'd like to know] 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 the other day..... .. #ifdef BSD nfiles = getdtablesize(); #else nfiles = NFILES; #endif .. 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), ignoring any errors from fclose(). 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 everyone 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 -- --