Question about the use of _newlib_flockfile_* in newlib

Corinna Vinschen
Mon Dec 17 18:05:00 GMT 2012

On Dec 17 10:06, Bin.Cheng wrote:
> Hi,
> I have two questions on _newlib_flockfile_*.
> 1.
> _fputc_r calls _putc_r to do the job, but both of them calls
> _newlib_flockfile_*. Is it OK? Why if it is.

I'm not quite sure, but I think the reason is that putc and, in analogy,
_putc_r might be defined as macro.  Newlib doesn't do that by default
for _putc_r, but target-specific code could.

> 2. In most functions, the macro ORIENT() is guarded by
> _newlib_flockfile_*, but it is not in _puts_r. Anything special or
> just missed something?

I had a look into the CVS annotation and it seems that this is not about
ORIENT, but about the fact that the __sfvwrite_r call in _puts_r was
never guarded by a flockfile/funlockfile (the predecessor of

I don't know why, though.  Jeff?


Corinna Vinschen
Cygwin Project Co-Leader
Red Hat

More information about the Newlib mailing list