The select function wrapper was rewritten to be non-blocking
on Linux systems, as it was stealing all the CPU time
from lower priority tasks when called from a higher priority task.
This is because the FreeRTOS scheduler does not know
that the task thread is sleeping during the system call.
This issue manifests all "slow" system calls on the Linux target,
but handling the case of select fixes the problems for most ESP-IDF components.
The FreeRTOS POSIX port documentation lists this as a known issue,
so user code is responsible handling this case if other system calls are used,
even if unknowingly.
This closes GH issue #14395 "select() blocks the FreeRTOS scheduler on Linux target"
This commit changes the approach used to override select function
in FreeRTOS simulator.
The previous approach relied on '--wrap', which is a feature of GNU
linker that performs symbol substitution at link time. Sadly this
feature is not present in macOS linker.
The alternative solution is to define 'select' wrapper as a regular
(exported) symbol, preventing it from being loaded from system
libraries. To call the "real" select implementation we use dlsym
function and find the function pointer at run time. This solution
works on both Linux and macOS.
This commit refactors the "freertos" component's structure as follows:
- "FreeRTOSConfig.h" related files moved to "./config" directory
- Refactored CMakeLists.txt file in preparation for v10.5.1 upgrade
- Grouped list appends based on component organization
- Removed some unecessarily public "include_dirs"
- Removed FreeRTOS-openocd.c
- uxTopUsedPriority has been added back to tasks.c since v10.4.2
- Thus the workaround in FreeRTOS-openocd.c is no longer needed and can
be removed.