[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new module 'fpurge'
From: |
Eric Blake |
Subject: |
Re: new module 'fpurge' |
Date: |
Mon, 16 Apr 2007 14:14:31 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Bruno Haible <bruno <at> clisp.org> writes:
>
> This generalizes the fpurge() function from the BSDs (FreeBSD, MacOS X,
> OpenBSD, NetBSD).
> #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
> fp->_p = fp->_bf._base;
> fp->_r = 0;
> fp->_w = ((fp->_flags & (__SLBF | __SNBF) == 0) /* fully buffered? */
> ? fp->_bf._size
> : 0);
> #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
Unfortunately, this implementation of fpurge crashes cygwin. It violates
assumptions made elsewhere in stdio, to the point that running tests-fpurge
under gdb hangs up the debugger, making it very difficult for me to figure out
what went wrong. I'm suspecting that the debugger does some sort of fflush
(NULL) between commands, but because the fpurge corrupted the test stream, the
stdin/out/err streams also get messed up. I'm trying to look more closely at
newlib sources, and figure out what fflush does that fpurge needs to copy,
while still leaving stdio in a happy state, but it may take a while.
It also lacks the HASUB/FREEUB macro usage present in the MacOS version of
fpurge, which means you may have introduced a memory leak.
--
Eric Blake