From d2aecc041215fa3c5218d1d11cdb52b4f0e75a67 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sun, 22 Sep 2024 16:24:48 +0200 Subject: [BOX32][wrapper] Added some basic 32bits X11 wrapping, fixed 32bits sem_XXX wrapping, and more 32bits wrapped functions --- src/wrapped32/wrappedlibpthread.c | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'src/wrapped32/wrappedlibpthread.c') diff --git a/src/wrapped32/wrappedlibpthread.c b/src/wrapped32/wrappedlibpthread.c index 5c3be2e4..5589d360 100755 --- a/src/wrapped32/wrappedlibpthread.c +++ b/src/wrapped32/wrappedlibpthread.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "wrappedlibs.h" @@ -55,6 +56,64 @@ EXPORT void my32___pthread_initialize() // nothing, the lib initialize itself now } +EXPORT int my32_sem_close(void** sem) +{ + int ret = 0; + ret = sem_close(*sem); + box_free(sem); + return ret; +} +EXPORT int my32_sem_destroy(void** sem) +{ + int ret = 0; + ret = sem_destroy(*sem); + box_free(*sem); + *sem = NULL; + return ret; +} +EXPORT int my32_sem_getvalue(void** sem, int* val) +{ + int ret = 0; + ret = sem_getvalue(*sem, val); + box_free(*sem); + *sem = NULL; + return ret; +} +EXPORT int my32_sem_init(void** sem, int pshared, uint32_t val) +{ + int ret = 0; + *sem = box_calloc(1, sizeof(sem_t)); + ret = sem_init(*sem, pshared, val); + return ret; +} +EXPORT void* my32_sem_open(const char* name, int flags) +{ + sem_t* sem = sem_open(name, flags); + if(!sem) + return sem; + void** ret = (void**)box_calloc(1, sizeof(void*)); + *ret = sem; + return ret; +} +EXPORT int my32_sem_post(void** sem) +{ + return sem_post(*sem); +} +EXPORT int my32_sem_timedwait(void** sem, void* t) +{ + return sem_timedwait(*sem, t); +} +EXPORT int my32_sem_trywait(void** sem) +{ + return sem_trywait(*sem); +} +EXPORT int my32_sem_wait(void** sem) +{ + return sem_wait(*sem); +} + + + #define PRE_INIT\ if(1) \ lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); \ -- cgit 1.4.1