This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Tue, Jan 30, 2007 at 03:25:43PM +0900, Kazunori Asayama wrote:
> Attached is a patch to implement SPU specific FILE structure and FILE
> related functions.

> +static _VOID
> +_DEFUN (__cleanup, (s),
> +	struct _reent *s)
> +{
> +  int i;
> +  for (i = 0; i < SPE_FOPEN_MAX; i++) {
> +    if (__fp[i]._fp) {
> +      fclose(&__fp[i]);
> +    }
> +  }
> +}
> +
> +_VOID
> +_DEFUN (__sinit, (s),
> +	struct _reent *s)
> +{
> +  s->__cleanup = __cleanup;
> +  s->__sdidinit = 1;
> +
> +  s->_stdin = &s->__sf[0];
> +  s->_stdin->_fp = SPE_STDIN;
> +
> +  s->_stdout = &s->__sf[1];
> +  s->_stdout->_fp = SPE_STDOUT;
> +
> +  s->_stderr = &s->__sf[2];
> +  s->_stderr->_fp = SPE_STDERR;
> +}

Where is the s->cleanup called? On exit?

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.

-- Patrick Mansfield


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]