Walter Tautz wrote: > please retain the CC to rbutterworth > > > Subject: Linux stdio question. > > On non-linux unix systems, one can reference __iob[] > to find all currently fopen()ed files > (e.g. when forking a new process one would generally > want to flush their buffers first, or perhaps close most of them). > > Linux's stdio.h doesn't provide such an array of open FILE pointers, > or at least if it does I can't find it. > > Any idea what they call it, > or how one can find all currently open FILEs? > > Perhaps there is a better way? > > A general guide to porting underlinux /debian would be appreciated.
I've never run into __iob, but it looks quite nonportable. A similarly nonportable way in linux is to examine /proc/self/fd/. I wonder if whatever unixes implement __iob have special kernel support for it, or does libc just fill it in? I can't see how it could always get at the info without kernel support. Just a point of personal interest.. Oh and AFAIK, the stdio layer takes care of flushing buffers for you at the right times. Except for signals and abort type stuff. Also, note the GNU extention, fcloseall(3). -- see shy jo
pgp00000.pgp
Description: PGP signature