about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-03-12 21:42:49 +0100
committerptitSeb <sebastien.chev@gmail.com>2023-03-12 21:42:49 +0100
commitc0f98bb0ec8b996d7fe35b1b311ec421587a94fd (patch)
treeff32eaf3b02b52dcd0fb329c97c000bccf377a08 /src
parent42b067dc39c7a5d32c59822f3d05a9b82394f6f1 (diff)
downloadbox64-c0f98bb0ec8b996d7fe35b1b311ec421587a94fd.tar.gz
box64-c0f98bb0ec8b996d7fe35b1b311ec421587a94fd.zip
Cleanup mutex wrapping
Diffstat (limited to 'src')
-rwxr-xr-xsrc/libtools/threads.c35
-rw-r--r--src/wrapped/generated/functions_list.txt9
-rw-r--r--src/wrapped/generated/wrappedlibpthreadtypes.h9
-rwxr-xr-xsrc/wrapped/wrappedlibpthread_private.h23
4 files changed, 6 insertions, 70 deletions
diff --git a/src/libtools/threads.c b/src/libtools/threads.c
index 32b9c7f4..381fa6cc 100755
--- a/src/libtools/threads.c
+++ b/src/libtools/threads.c
@@ -807,11 +807,6 @@ EXPORT int my_pthread_kill_old(x64emu_t* emu, void* thread, int sig)
 //}
 
 #ifndef NOALIGN
-EXPORT int my_pthread_mutex_destroy(pthread_mutex_t *m)
-{
-	int ret = pthread_mutex_destroy(m);
-	return ret;
-}
 typedef union my_mutexattr_s {
 	int					x86;
 	pthread_mutexattr_t nat;
@@ -895,9 +890,6 @@ EXPORT int my_pthread_mutexattr_settype(x64emu_t* emu, my_mutexattr_t *attr, int
 }
 EXPORT int my___pthread_mutexattr_settype(x64emu_t* emu, my_mutexattr_t *attr, int t) __attribute__((alias("my_pthread_mutexattr_settype")));
 
-// mutex
-int my___pthread_mutex_destroy(pthread_mutex_t *m) __attribute__((alias("my_pthread_mutex_destroy")));
-
 #ifdef __SIZEOF_PTHREAD_MUTEX_T
 #if __SIZEOF_PTHREAD_MUTEX_T == 48
 #define MUTEX_OVERSIZED_8
@@ -926,33 +918,6 @@ EXPORT int my_pthread_mutex_init(pthread_mutex_t *m, my_mutexattr_t *att)
 }
 EXPORT int my___pthread_mutex_init(pthread_mutex_t *m, my_mutexattr_t *att) __attribute__((alias("my_pthread_mutex_init")));
 
-EXPORT int my_pthread_mutex_lock(pthread_mutex_t *m)
-{
-	int ret = pthread_mutex_lock(m);
-	return ret;
-}
-EXPORT int my___pthread_mutex_lock(pthread_mutex_t *m) __attribute__((alias("my_pthread_mutex_lock")));
-
-EXPORT int my_pthread_mutex_timedlock(pthread_mutex_t *m, const struct timespec * t)
-{
-	int ret = pthread_mutex_timedlock(m, t);
-	return ret;
-}
-EXPORT int my___pthread_mutex_trylock(pthread_mutex_t *m, const struct timespec * t) __attribute__((alias("my_pthread_mutex_timedlock")));
-
-EXPORT int my_pthread_mutex_trylock(pthread_mutex_t *m)
-{
-	int ret = pthread_mutex_trylock(m);
-	return ret;
-}
-EXPORT int my___pthread_mutex_unlock(pthread_mutex_t *m) __attribute__((alias("my_pthread_mutex_trylock")));
-
-EXPORT int my_pthread_mutex_unlock(pthread_mutex_t *m)
-{
-	int ret = pthread_mutex_unlock(m);
-	return ret;
-}
-
 typedef union my_condattr_s {
 	int					x86;
 	pthread_condattr_t 	nat;
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 73f50f8e..3f0c46fe 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -3533,10 +3533,6 @@ wrappedlibpthread:
   - __pthread_unregister_cancel
   - __pthread_unwind_next
 - iFp:
-  - __pthread_mutex_destroy
-  - __pthread_mutex_lock
-  - __pthread_mutex_trylock
-  - __pthread_mutex_unlock
   - __pthread_mutexattr_destroy
   - __pthread_mutexattr_init
   - pthread_attr_destroy
@@ -3548,10 +3544,6 @@ wrappedlibpthread:
   - pthread_condattr_destroy
   - pthread_condattr_init
   - pthread_getattr_default_np
-  - pthread_mutex_destroy
-  - pthread_mutex_lock
-  - pthread_mutex_trylock
-  - pthread_mutex_unlock
   - pthread_mutexattr_destroy
   - pthread_mutexattr_init
   - pthread_setattr_default_np
@@ -3599,7 +3591,6 @@ wrappedlibpthread:
   - pthread_condattr_getpshared
   - pthread_key_create
   - pthread_mutex_init
-  - pthread_mutex_timedlock
   - pthread_mutexattr_getkind_np
   - pthread_mutexattr_getprotocol
   - pthread_mutexattr_gettype
diff --git a/src/wrapped/generated/wrappedlibpthreadtypes.h b/src/wrapped/generated/wrappedlibpthreadtypes.h
index e30c74ba..6d230b2f 100644
--- a/src/wrapped/generated/wrappedlibpthreadtypes.h
+++ b/src/wrapped/generated/wrappedlibpthreadtypes.h
@@ -30,10 +30,6 @@ typedef int64_t (*iFpppp_t)(void*, void*, void*, void*);
 	GO(__pthread_register_cancel, vFp_t) \
 	GO(__pthread_unregister_cancel, vFp_t) \
 	GO(__pthread_unwind_next, vFp_t) \
-	GO(__pthread_mutex_destroy, iFp_t) \
-	GO(__pthread_mutex_lock, iFp_t) \
-	GO(__pthread_mutex_trylock, iFp_t) \
-	GO(__pthread_mutex_unlock, iFp_t) \
 	GO(__pthread_mutexattr_destroy, iFp_t) \
 	GO(__pthread_mutexattr_init, iFp_t) \
 	GO(pthread_attr_destroy, iFp_t) \
@@ -45,10 +41,6 @@ typedef int64_t (*iFpppp_t)(void*, void*, void*, void*);
 	GO(pthread_condattr_destroy, iFp_t) \
 	GO(pthread_condattr_init, iFp_t) \
 	GO(pthread_getattr_default_np, iFp_t) \
-	GO(pthread_mutex_destroy, iFp_t) \
-	GO(pthread_mutex_lock, iFp_t) \
-	GO(pthread_mutex_trylock, iFp_t) \
-	GO(pthread_mutex_unlock, iFp_t) \
 	GO(pthread_mutexattr_destroy, iFp_t) \
 	GO(pthread_mutexattr_init, iFp_t) \
 	GO(pthread_setattr_default_np, iFp_t) \
@@ -91,7 +83,6 @@ typedef int64_t (*iFpppp_t)(void*, void*, void*, void*);
 	GO(pthread_condattr_getpshared, iFpp_t) \
 	GO(pthread_key_create, iFpp_t) \
 	GO(pthread_mutex_init, iFpp_t) \
-	GO(pthread_mutex_timedlock, iFpp_t) \
 	GO(pthread_mutexattr_getkind_np, iFpp_t) \
 	GO(pthread_mutexattr_getprotocol, iFpp_t) \
 	GO(pthread_mutexattr_gettype, iFpp_t) \
diff --git a/src/wrapped/wrappedlibpthread_private.h b/src/wrapped/wrappedlibpthread_private.h
index 2c16c02d..bfb3fdea 100755
--- a/src/wrapped/wrappedlibpthread_private.h
+++ b/src/wrapped/wrappedlibpthread_private.h
@@ -180,12 +180,17 @@ GOM(__pthread_mutexattr_settype, iFEpi)
 GOM(pthread_mutexattr_settype, iFEpi)
 #endif
 // pthread_mutex_consistent_np
-#ifdef NOALIGN
 GO(__pthread_mutex_destroy, iFp)
 GO(pthread_mutex_destroy, iFp)
 // pthread_mutex_getprioceiling
+#ifdef NOALIGN
 GO(__pthread_mutex_init, iFpp)
 GO(pthread_mutex_init, iFpp)
+#else
+// phtread_mutex_t is 40 bytes on x86_64, but 48bytes on ARM64
+GOM(__pthread_mutex_init, iFpp)
+GOM(pthread_mutex_init, iFpp)
+#endif
 GO(__pthread_mutex_lock, iFp)
 GO(pthread_mutex_lock, iFp)
 // pthread_mutex_setprioceiling
@@ -194,22 +199,6 @@ GO(__pthread_mutex_trylock, iFp)
 GO(pthread_mutex_trylock, iFp)
 GO(__pthread_mutex_unlock, iFp)
 GO(pthread_mutex_unlock, iFp)
-#else
-// phtread_mutex_t is 40 bytes on x86_64, but 48bytes on ARM64
-GOM(__pthread_mutex_destroy, iFp)
-GOM(pthread_mutex_destroy, iFp)
-// pthread_mutex_getprioceiling
-GOM(__pthread_mutex_init, iFpp)
-GOM(pthread_mutex_init, iFpp)
-GOM(__pthread_mutex_lock, iFp)
-GOM(pthread_mutex_lock, iFp)
-// pthread_mutex_setprioceiling
-GOM(pthread_mutex_timedlock, iFpp)
-GOM(__pthread_mutex_trylock, iFp)
-GOM(pthread_mutex_trylock, iFp)
-GOM(__pthread_mutex_unlock, iFp)
-GOM(pthread_mutex_unlock, iFp)
-#endif
 GOM(pthread_once, iFEpp)
 GOM(__pthread_once, iFEpp)
 GOM(__pthread_register_cancel, vFEp)