about summary refs log tree commit diff stats
path: root/src/wrapped/wrappedlibpthread.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-02-26 19:22:53 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-02-26 19:22:53 +0100
commit13404ed090453ffa1a2b475b004b74db7086ff74 (patch)
tree9d1fb5cbad4f90ce1dcd2df7f7220b6dea6d4755 /src/wrapped/wrappedlibpthread.c
parentff6cc844821439a8f50b68b27e6f1ac5264579c8 (diff)
downloadbox64-13404ed090453ffa1a2b475b004b74db7086ff74.tar.gz
box64-13404ed090453ffa1a2b475b004b74db7086ff74.zip
Added ability to staticaly build box64 (for #1045 and #310, maybe a few others tickets)
Diffstat (limited to 'src/wrapped/wrappedlibpthread.c')
-rw-r--r--src/wrapped/wrappedlibpthread.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/src/wrapped/wrappedlibpthread.c b/src/wrapped/wrappedlibpthread.c
index d29218ed..9b0184c6 100644
--- a/src/wrapped/wrappedlibpthread.c
+++ b/src/wrapped/wrappedlibpthread.c
@@ -1,3 +1,4 @@
+#define __USE_UNIX98
 #define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
@@ -20,30 +21,6 @@
 const char* libpthreadName = "libpthread.so.0";
 #define LIBNAME libpthread
 
-
-//int my_pthread_create(x64emu_t *emu, void* t, void* attr, void* start_routine, void* arg); //implemented in thread.c
-//int my_pthread_key_create(x64emu_t* emu, void* key, void* dtor);
-//int my___pthread_key_create(x64emu_t* emu, void* key, void* dtor);
-//int my_pthread_once(x64emu_t* emu, void* once, void* cb);
-//int my___pthread_once(x64emu_t* emu, void* once, void* cb);
-//int my_pthread_cond_broadcast(x64emu_t* emu, void* cond);
-//int my_pthread_cond_destroy(x64emu_t* emu, void* cond);
-//int my_pthread_cond_init(x64emu_t* emu, void* cond, void* attr);
-//int my_pthread_cond_signal(x64emu_t* emu, void* cond);
-//int my_pthread_cond_timedwait(x64emu_t* emu, void* cond, void* mutex, void* abstime);
-//int my_pthread_cond_wait(x64emu_t* emu, void* cond, void* mutex);
-//int my_pthread_mutexattr_setkind_np(x64emu_t* emu, void* t, int kind);
-//int my_pthread_attr_setscope(x64emu_t* emu, void* attr, int scope);
-//void my__pthread_cleanup_push_defer(x64emu_t* emu, void* buffer, void* routine, void* arg);
-//void my__pthread_cleanup_push(x64emu_t* emu, void* buffer, void* routine, void* arg);
-//void my__pthread_cleanup_pop(x64emu_t* emu, void* buffer, int exec);
-//void my__pthread_cleanup_pop_restore(x64emu_t* emu, void* buffer, int exec);
-//int my_pthread_kill(x64emu_t* emu, void* thread, int sig);
-//int my_pthread_getaffinity_np(x64emu_t* emu, pthread_t thread, int cpusetsize, void* cpuset);
-//int my_pthread_setaffinity_np(x64emu_t* emu, pthread_t thread, int cpusetsize, void* cpuset);
-//int my_pthread_attr_setaffinity_np(x64emu_t* emu, void* attr, uint32_t cpusetsize, void* cpuset);
-
-
 //EXPORT int my_pthread_attr_setschedparam(x64emu_t* emu, void* attr, void* param)
 //{
 //    int policy;
@@ -82,4 +59,21 @@ EXPORT void my___pthread_initialize()
     // nothing, the lib initialize itself now
 }
 
+#ifdef STATICBUILD
+#include <semaphore.h>
+#include "libtools/static_threads.h"
+
+extern void* __pthread_getspecific(size_t);
+extern int __pthread_mutex_destroy(void*);
+extern int __pthread_mutex_lock(void*);
+extern int __pthread_mutex_trylock(void*);
+extern int __pthread_mutex_unlock(void*);
+extern int __pthread_rwlock_init(void*, void*);
+extern int __pthread_rwlock_rdlock(void*);
+extern int __pthread_rwlock_unlock(void*);
+extern int __pthread_rwlock_wrlock(void*);
+extern int __pthread_setspecific(size_t, void*);
+extern int pthread_sigmask(int, void*, void*);
+#endif
+
 #include "wrappedlib_init.h"