bugAVR C Runtime Library - Bugs: bug #23128, Non-reentrant library calls should...

 
 

bug #23128: Non-reentrant library calls should be made reentrant

Submitted by:  Mark Litwack <mlitwack>
Submitted on:  Thu 01 May 2008 02:45:56 PM UTC  
 
Category: Feature RequestSeverity: 1 - Wish
Priority: 1 - LaterItem Group: libc code
Status: NonePercent Complete: 0%
Assigned to: NoneOpen/Closed: Open
Release: 1.6.1Fixed Release: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 01 May 2008 02:45:56 PM UTC, original submission:

The avr-libc FAQ has a more detailed discussion on
non-reentrant library calls. (See patch #6500 if the
reentrant update to the FAQ has not yet been applied.)

This bug has been opened as a placeholder for those calls
which could be made reentrant. It is low priority since
reasonable workarounds exist.

Short duration calls and macros that appear in the FAQ that
can easily be reentrant with a cli()/sei() or ATOMIC_BLOCK()
are not included in this bug.

------------------------------------------------------------

Calls: strtod(), strtol(), strtoul()

Issue: They all use the global "errno". Errno
could be returned wrong.

Possible fix: Create *_r versions, similar to strtok_r(),
where the error status is returned via a
passed pointer to an int or uint8_t.

------------------------------------------------------------

Calls: printf(), vprintf(), puts()

Issue: stdout is global and these calls alter a
character counter in stdout's FILE struct via
vfprintf(). Returned character count could be
wrong.

Possible fix: Instead of changing values in stdout, perhaps
introduce another call layer like
vfprintf_r(), so that character count can be
kept on the stack.

------------------------------------------------------------

Calls: printf_P(), vprintf_P(), puts_P()

Issue: stdout is global and in addition to the
character count issue above, these calls also
alter a flag in stdout to make vfprintf()
read format strings from PGM space.

Possible fix: Similar to above. A call layer to keep the
keep the flag values on the stack could work.

------------------------------------------------------------

Calls: fprintf(), fprintf_P(), vfprintf(),
vfprintf_P(), fputs(), fputs_P()

Issue: The same problems exist as with stdout above
when using a global FILE with these calls.

Possible fix: Same as printf().

------------------------------------------------------------

Calls: assert()

Issue: Uses fprintf().

Possible fix: Fixed when fprintf() is fixed.

------------------------------------------------------------

Calls: getchar(), gets()

Issue: stdin is global and these calls alter flags,
character count, and the unget buffer in
stdin's FILE struct.

Possible fix: None? Needs locking because unget buffer is
persistent between calls and locking is
implementation dependent. Could create *_r
versions and have a non-global unget but it
may not be worth the trouble.

------------------------------------------------------------

Calls: fgetc(), ungetc(), fgets(), scanf(),
scanf_P(), fscanf(), fscanf_P(), vscanf(),
vfscanf(), vfscanf_P(), fread()

Issue: The same problems exist as with stdin above
when using a global FILE with these calls.

Possible fix: None? See above for getchar().

------------------------------------------------------------

Mark Litwack <mlitwack>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by arcanum (Updated the item)
  • -unavailable- added by mlitwack (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 16 Nov 2012 06:37:46 PM UTCarcanumPriority3 - Low=>1 - Later
    Mon 11 Aug 2008 02:49:57 AM UTCarcanumSeverity3 - Normal=>1 - Wish
      Priority5 - Normal=>3 - Low

    Back to the top


    Powered by Savane 3.1-cleanup