This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
[PATCH] Re: Queries concerning RTOS protection in newllib
- From: Antony KING <antony dot king at st dot com>
- To: Jeff Johnston <jjohnstn at redhat dot com>
- Cc: Newlib Mailing List <newlib at sources dot redhat dot com>
- Date: Wed, 16 Jun 2004 18:56:22 +0100
- Subject: [PATCH] Re: Queries concerning RTOS protection in newllib
- Organization: STMicroelectronics (R&D) Ltd
- References: <40C48348.2010303@st.com> <40CA19A8.4000705@redhat.com> <40CDE7EB.9040902@st.com>
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