From bedfa5788d6ab8846dbf35a560f5797a3fb6255b Mon Sep 17 00:00:00 2001 From: Ilya Tagunov Date: Wed, 27 Nov 2024 13:21:01 +0000 Subject: [PATCH] libc: arcmwdt: increase the number of preallocated locks Increase the number of locks to match what the ARC MWDT libc requires now. The library wants to have 2 locks per each available FILE entry, and then some more. Also do not include an internal libc header, as all that is needed from that header is a simple typedef. Signed-off-by: Ilya Tagunov --- lib/libc/arcmwdt/threading.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/libc/arcmwdt/threading.c b/lib/libc/arcmwdt/threading.c index dbeb4436b7d..af9cdf76b13 100644 --- a/lib/libc/arcmwdt/threading.c +++ b/lib/libc/arcmwdt/threading.c @@ -6,22 +6,25 @@ #ifdef CONFIG_MULTITHREADING +#include #include #include #include #include #include -#include <../lib/src/c/inc/internal/thread.h> #ifndef CONFIG_USERSPACE #define ARCMWDT_DYN_LOCK_SZ (sizeof(struct k_mutex)) -#define ARCMWDT_MAX_DYN_LOCKS 10 +/* The library wants 2 locks per available FILE entry, and then some more */ +#define ARCMWDT_MAX_DYN_LOCKS (FOPEN_MAX * 2 + 5) K_MEM_SLAB_DEFINE(z_arcmwdt_lock_slab, ARCMWDT_DYN_LOCK_SZ, ARCMWDT_MAX_DYN_LOCKS, sizeof(void *)); #endif /* !CONFIG_USERSPACE */ LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); +typedef void *_lock_t; + void _mwmutex_create(_lock_t *mutex_ptr) { bool alloc_fail;