[PATCH 2/3] SPU stdio: FILE related stuffs

Patrick Mansfield patmans@us.ibm.com
Fri Feb 2 03:25:00 GMT 2007

On Thu, Feb 01, 2007 at 11:41:38AM +0900, Kazunori Asayama wrote:
> Patrick Mansfield <patmans@us.ibm.com> wrote:
> > Where is the s->cleanup called? On exit?
> Yes.
> > And why call fclose() in the cleanup? So main memory/PPE side buffers are
> > flushed?
> > 
> > Won't that happen by default in the PPE executable? I can't figure out
> > where/how glibc implements it ... but it must be flushing those buffers.
> As you say, PPE's libc will perform such cleanups, but such things
> will be done at the end of the PPE process. So if we don't perform
> cleanups at the end of each SPE execution, the files which are not
> closed explicitly by SPE, are left open until the corresponding
> process exits.

Can we just call fcloseall()? I don't fully understand the reent code. 

Or better, add code in libspe to track and close them all for us? That
sounds better as it would save space in the LS.

> In general, because multiple SPE contexts can be run in a PPE process
> and/or because a PPE process may not exit as soon as an SPE exits, we
> should do cleanups for each SPE execution.

What about close()? Looks like we also need to close all files opened by
SPU code (not just the ones opened via fopen()).

-- Patrick Mansfield

More information about the Newlib mailing list