diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-09-22 16:24:48 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-09-22 16:24:48 +0200 |
| commit | d2aecc041215fa3c5218d1d11cdb52b4f0e75a67 (patch) | |
| tree | cae1d496ce0e35e0137aa7cf124f3174153a97ea /src/wrapped32/wrappedlibpthread.c | |
| parent | 710d537f3949d55944bc96e73927c9d30bdf13c2 (diff) | |
| download | box64-d2aecc041215fa3c5218d1d11cdb52b4f0e75a67.tar.gz box64-d2aecc041215fa3c5218d1d11cdb52b4f0e75a67.zip | |
[BOX32][wrapper] Added some basic 32bits X11 wrapping, fixed 32bits sem_XXX wrapping, and more 32bits wrapped functions
Diffstat (limited to 'src/wrapped32/wrappedlibpthread.c')
| -rwxr-xr-x | src/wrapped32/wrappedlibpthread.c | 59 |
1 files changed, 59 insertions, 0 deletions
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 <dlfcn.h> #include <errno.h> #include <pthread.h> +#include <semaphore.h> #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); \ |