1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-16 20:55:20 +03:00
aports/testing/massivethreads/0001-musl-fixes.patch
Hazem a5cbdcd628 testing/massivethreads: new aport
https://github.com/massivethreads/massivethreads
A lightweight threads library required by smlsharp
2022-04-17 16:59:02 +00:00

77 lines
1.8 KiB
Diff

diff --git a/src/myth_io.h b/src/myth_io.h
index e0b61551b8..832629c352 100644
--- a/src/myth_io.h
+++ b/src/myth_io.h
@@ -6,6 +6,7 @@
#define MYTH_IO_H_
#include <sys/socket.h>
+#include <sys/select.h>
#include <stdint.h>
#include <stdarg.h>
diff --git a/src/Makefile.am b/patchMakefile.am
index f55b46a5e5..f9a3e631ae 100644
--- a/src/Makefile.am
+++ b/patchMakefile.am
@@ -18,7 +18,8 @@ COMMON_SRCS = \
myth_context.c \
myth_if_native.c \
myth_real.c \
- myth_eco.c
+ myth_eco.c \
+ pthread.c
# sources for wrapping system functions (used only for -dl and -ld versions)
WRAP_SRCS = \
diff --git a/src/pthread.h b/src/pthread.h
new file mode 100644
index 0000000000..1a81566b46
--- /dev/null
+++ b/src/pthread.h
@@ -0,0 +1,15 @@
+#ifndef _MUSL_PTHREAD_H_OVERRIDE
+#define _MUSL_PTHREAD_H_OVERRIDE
+
+#include <errno.h>
+#include_next <pthread.h>
+
+// musl's pthread_equal is a macro
+#undef pthread_equal
+int pthread_equal(pthread_t t1, pthread_t t2);
+
+// musl doesn't define mutexattr functions
+int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
+
+#endif//_MUSL_PTHREAD_H_OVERRIDE
diff --git a/src/pthread.c b/src/pthread.c
new file mode 100644
index 0000000000..10f57c0fb7
--- /dev/null
+++ b/src/pthread.c
@@ -0,0 +1,18 @@
+#include <pthread.h>
+
+int pthread_equal(pthread_t t1, pthread_t t2) {
+ return t1 == t2;
+}
+
+int pthread_mutexattr_getprioceiling( const pthread_mutexattr_t *restrict attr
+ , int *restrict prioceiling )
+{
+ if (prioceiling) *prioceiling = 99;
+ return 0;
+}
+
+int pthread_mutexattr_setprioceiling( pthread_mutexattr_t *attr
+ , int prioceiling )
+{
+ return EPERM;
+}