Re: [ot] Linux stdio question, howto find fopened files
On Wed, Mar 19, 2003 at 01:32:26PM -0500, 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.
This seems to be a glibc question. Folks on
news:comp.os.linux.development.[apps|sys] might know better. Referencing
internal data structures is inherently non-portable. You might look in
/proc/<pid>/fd/ which seems to have file descriptor numbers represented
as symbolic links to the file(s) opened.
fflush (NULL); flushes all fopen'ed files, but that doesn't mean writes
are actually committed (you need sync/fsync for that).
> 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.
Linux Standards Base?
--
echo ">gra.fcw@2ztr< eryyvZ .T pveR" | rot13 | reverse
Reply to: