This is the mail archive of the newlib@sources.redhat.com 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]

[PATCH] Re: Queries concerning RTOS protection in newllib


Hi yet again,

Please find attached some additional patches to newlib which hopefully fix the following problems I have discovered when using newlib built with non-stub versions of the locking API (in sys/lock.h) and in a multi-threaded environment:

* Missing initialisation of the _lock field in FILE objects declared locally on the stack in the implementations of the sprintf/sscanf class of functions.

Only files in libc/stdio affected: asprintf.c, siprintf.c, snprintf.c, sprintf.c, sscanf.c, vasprintf.c, vsnprintf.c, vsprintf.c, vsscanf.c.

* _GLOBAL_REENT structure "walked" (_fwalk) multiple times when cleaning up the FILE objects (via the _cleanup_r function) in a multi-threading environment where _reclaim_reent is called on the death (and deletion) of each task. This is a problem now that the function being used to walk the FILE objects is fclose and not as previously fflush. As a result all open FILE objects are closed on the death of the first task, which is not very clever :-(. Solution is to remove the additional walking of _GLOBAL_REENT in _fwalk/_fwalk_reent until explicitly invoked via the call to _cleanup_r of _GLOBAL_REENT in the exit function.

File affected: libc/stdio/fwalk.c

* I have also removed, what I believe to be, an out of date check for _REENT_ONLY in libc/stdlib/exit.c since there does not exist anywhere in the newlib sources implementations of _exit_r.

Please note that this patch assumes a previous patch I have submitted (http://sources.redhat.com/ml/newlib/2004/msg00293.html) has been applied (really only the change to newlib/ChangeLog).

Cheers,

Antony.

Antony King wrote:
Hi again,

Please find attached a patch for some changes which were overlooked in my original patch; tightening up the definition of the lock macros in libc/include/sys/stdio.h (missing parenthesis around macro arguments) and a missed file (libc/stdio64/freopen64.c) in the removal the fp lock casting. Hope thats it for the time being.

Thanks,

Antony.

Jeff Johnston wrote:

Thanks Antony. Patch checked in. A patch was also required to get x86-linux building with these changes so I added that as well. In the future, it would be helpful to me if you could add a ChangeLog entry for any changes you make.

-- Jeff J.

-- ----------------------------------------------------------------- Antony King | Email: antony.king@st.com STMicroelectronics (R&D) Ltd. | Bristol, BS32 4SQ. United Kingdom. | Tel: +44 (0)1454 462646

Attachment: newlib.patch.gz
Description: GNU Zip compressed data


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