zephyr/lib/libc
Keith Packard 021923b58a libc/picolibc: Use mutexes instead of semaphores for non-recursive locks
Picolibc has both recursive and non-recursive mutex uses. The bulk of the
library locking uses the global libc lock, which is a recursive mutex as
that greatly simplifies the implementation.

The only use of non-recursive mutexes is in the stdio code when dealing
with file system I/O via fopen.

Using mutexes for both APIs is valid; the assumption picolibc makes is that
the non-recursive mutexes are somehow cheaper or faster and should be
preferred. However, in Zephyr, recursive mutexes are the default and the
non-recursive locks for picolibc were implemented using semaphores.

Switch the non-recursive picolibc locks to just invoking the existing
recursive functions using mutexes. This avoids pulling in another lock
implementation, saving a bit of space.

This also lets the kernel.memory_protection.mem_map test work on
qemu_x86_tiny where the amount of memory available is 320kB and that is
nearly filled by this test case, leaving too little space for allocating
pages in the k_mem_map_unmap test.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-07-10 15:11:15 +02:00
..
arcmwdt ARC: Fix portability.posix.common.arcmwdtlib test 2023-06-09 14:17:50 -04:00
armstdc libc: Move strnlen into common 2023-05-08 09:59:27 +02:00
common libC COMMON_LIBC_MALLOC_ARENA_SIZE: provide default for POSIX ARCH 2023-06-22 17:16:17 -04:00
minimal libC minimal: Fix for POSIX arch 2023-06-22 17:16:17 -04:00
newlib init: remove the need for a dummy device pointer in SYS_INIT functions 2023-04-12 14:28:07 +00:00
picolibc libc/picolibc: Use mutexes instead of semaphores for non-recursive locks 2023-07-10 15:11:15 +02:00
CMakeLists.txt lib: syscalls: use zephyr_syscall_header 2023-06-17 07:57:45 -04:00
Kconfig libC: PICOLIBC_SUPPORTED: Enable for NATIVE_LIBRARY 2023-07-05 07:01:19 -04:00