AVR C Runtime Library - Bugs: bug #23128, Non-reentrant library calls should...
You are not allowed to post comments on this tracker with your current authentication level.
bug #23128: Non-reentrant library calls should be made reentrant
Submitter: | Mark Litwack <mlitwack> | ||
Submitted: | Thu 01 May 2008 02:45:56 PM UTC | ||
Category: | Feature Request | Severity: | 1 - Wish |
Priority: | 1 - Later | Item Group: | libc code |
Status: | None | Assigned to: | None |
Percent Complete: | 0% | Open/Closed: | Open |
Release: | 1.6.1 | Fixed Release: | None |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
Carbon-Copy List
Follow 3 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2012-11-16 | arcanum | Priority | 3 - Low | 1 - Later | |
2008-08-11 | arcanum | Severity | 3 - Normal | 1 - Wish | |
Priority | 5 - Normal | 3 - Low |
Powered by Savane 3.13-f8d8.
Corresponding source code
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().
------------------------------------------------------------