The Linux target's sys/lock.h provided no-op inline stubs, which was
safe only under the assumption of single-threaded execution. With the
new FreeRTOS Linux simulator using soft preemption, an outgoing task
can still run concurrently with the incoming task until it reaches a
yield point, making no-op locks unsafe.
Replace the no-op implementation with real pthread mutexes:
- Change _lock_t from `typedef int` to `typedef void *` (pointer to a
heap-allocated pthread_mutex_t).
- Implement all _lock_* functions in a new lock.c, supporting both
normal and recursive mutexes.
- Zero-initialized locks are lazily created on first acquire using
double-checked locking, preserving newlib/esp_libc semantics.
- Add lock.c unconditionally to the linux component sources and link
pthread.
The `srcs` list variable is used without initialization when building
for linux target. Initialize it explicitly.
Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
* Users can now use libbsd string.h and sys/cdefs.h functionality
(e.g., strlcpy, containerof) on Linux by just including
string.h or sys/cdefs.h. In other words, the includes are the same
on the Linux target as well as on chips targets (ESP32, etc.).
* libbsd linking is done by the linux component (belongs to common
components) now instead of handling it separately in each component
linux/lwip: Wrap some IO posix functions
* to workaourd the FreeRTOS EINTR issue (when building without lwip)
* to correctly choose the sub-system based on fd (when building with
lwip) -- passing control to either linux/system or to lwip
This commit also addapts tapio-if to provide DHCP client by default and
configurable settings for static IP