mbed-os/platform/source
Kevin Bracey 5ab6f1cef6 Make readdir reentrant
Remove the static allocation for the dirent, and allocate it from the
heap during opendir().

Removing the static data can reduce RAM usage on some toolchains when
directories are not being used. The static allocation sometimes is
combined with the file handle array and can't be dropped by the linker.

Original readdir() was not thread-safe at all.

This was in violation of POSIX which states the result of readdir "is
not overwritten by another call to readdir() on a different directory
stream."

POSIX also defines readdir_r() as separate totally reentrant form where
the caller allocates the dirent, but this is generally deprecated as it
opens the door for an inadequate allocation causing a stack smash. Full
reentrancy is not typically necessary - having readdir()'s buffer data
be per-DIR is generally sufficient.
2020-09-04 16:58:23 +03:00
..
TARGET_CORTEX_A/TOOLCHAIN_IAR CMSIS: Restructure ported CMSIS_5 2020-09-01 15:55:13 +01:00
TARGET_CORTEX_M Fix IAR assembler errors on except.S 2020-07-29 08:25:41 -07:00
minimal-printf Removed mbed_minimal_formatted_string_character 2020-03-23 13:51:47 +00:00
ATCmdParser.cpp busy s... fix (ONME-4352) 2019-12-12 09:36:34 +02:00
CThunkBase.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
CriticalSectionLock.cpp Remove the deprecated CriticalSectionLock APIs 2020-02-28 07:19:19 -08:00
DeepSleepLock.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
FileBase.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
FileHandle.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
FilePath.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
FileSystemHandle.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
LocalFileSystem.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
Stream.cpp mbed_retarget: Add a minimal console implementation to provide basic functionalities 2019-11-11 15:14:00 +00:00
SysTimer.cpp platform: move internal headers to internal/ 2020-08-20 08:58:00 +01:00
mbed_alloc_wrappers.cpp Incorporated the review comments 2020-09-01 14:46:36 +01:00
mbed_application.c Remove ARMC5 reference from Mbed OS platform 2020-03-19 10:48:14 -07:00
mbed_assert.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_atomic_impl.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_board.c Remove nRF51 targets 2020-05-13 10:36:50 +01:00
mbed_crash_data_offsets.h Streamline crash data access 2020-04-24 10:59:13 +03:00
mbed_critical.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_error.c platform: move internal headers to internal/ 2020-08-20 08:58:00 +01:00
mbed_error_hist.c platform: move internal headers to internal/ 2020-08-20 08:58:00 +01:00
mbed_interface.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_mem_trace.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_mktime.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_mpu_mgmt.c platform: fix SPDX identifiers 2020-02-21 07:00:58 +00:00
mbed_os_timer.cpp Update platform/source/mbed_os_timer.cpp 2020-08-21 14:55:58 +01:00
mbed_poll.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_power_mgmt.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_retarget.cpp Make readdir reentrant 2020-09-04 16:58:23 +03:00
mbed_rtc_time.cpp Use std::chrono based functions 2020-06-17 14:52:50 +01:00
mbed_sdk_boot.c CMSIS: Restructure ported CMSIS_5 2020-09-01 15:55:13 +01:00
mbed_semihost_api.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_stats.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_thread.cpp platform: move internal headers to internal/ 2020-08-20 08:58:00 +01:00
mbed_wait_api_no_rtos.c Remove mbed wait deprecated APIs 2020-04-08 10:35:07 +01:00