futex: statically define table and mutex

This commit is contained in:
Matheus
2026-04-23 15:31:05 -03:00
parent 71dd6d1125
commit 6678472362
+2 -13
View File
@@ -7,9 +7,8 @@
#include <kernel/alloc.h> #include <kernel/alloc.h>
#include <arch/cpu.h> #include <arch/cpu.h>
static mutex_t futexmutex; static MUTEX_DEFINE(futexmutex);
static hashtable_t hashtable; HASHTABLE_DEFINE_STATIC(hashtable, 256);
static bool hashtableinit;
typedef struct { typedef struct {
pollheader_t pollheader; pollheader_t pollheader;
@@ -46,16 +45,6 @@ syscallret_t syscall_futex(context_t *, uint32_t *futexp, int op, uint32_t value
return ret; return ret;
} }
if (unlikely(hashtableinit == false)) {
if (unlikely(hashtable_init(&hashtable, 256))) {
ret.errno = ENOMEM;
return ret;
}
hashtableinit = true;
MUTEX_INIT(&futexmutex);
}
timespec_t timespec = {0}; timespec_t timespec = {0};
if (tm) { if (tm) {
ret.errno = usercopy_fromuser(&timespec, tm, sizeof(timespec_t)); ret.errno = usercopy_fromuser(&timespec, tm, sizeof(timespec_t));