Question about the use of _newlib_flockfile_* in newlib
Tue Dec 18 21:44:00 GMT 2012
On 12/17/2012 05:53 AM, Corinna Vinschen wrote:
> On Dec 17 10:06, Bin.Cheng wrote:
>> I have two questions on _newlib_flockfile_*.
>> _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?
Don't know why this is the case. Perhaps puts used to call fputs
previously which has the lock protection so the locks were never needed.
I can't see any reason not to add them in the present case.
-- Jeff J.
More information about the Newlib