summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/thread/pthread_getattr_np.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 16:08:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 16:08:03 +0000
commitf1db79e6e5c383cf76f3bf0dd42115d19591a72b (patch)
tree3f9509008e8a130c45b7e31b1520d66d720493ec /libc-top-half/musl/src/thread/pthread_getattr_np.c
parentAdding upstream version 0.0~git20230821.ec4566b. (diff)
downloadwasi-libc-upstream.tar.xz
wasi-libc-upstream.zip
Adding upstream version 0.0~git20240411.9e8c542.upstream/0.0_git20240411.9e8c542upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libc-top-half/musl/src/thread/pthread_getattr_np.c')
-rw-r--r--libc-top-half/musl/src/thread/pthread_getattr_np.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/thread/pthread_getattr_np.c b/libc-top-half/musl/src/thread/pthread_getattr_np.c
index 2881831..c23e5d7 100644
--- a/libc-top-half/musl/src/thread/pthread_getattr_np.c
+++ b/libc-top-half/musl/src/thread/pthread_getattr_np.c
@@ -1,7 +1,9 @@
#define _GNU_SOURCE
#include "pthread_impl.h"
#include "libc.h"
+#ifdef __wasilibc_unmodified_upstream
#include <sys/mman.h>
+#endif
int pthread_getattr_np(pthread_t t, pthread_attr_t *a)
{
@@ -12,6 +14,7 @@ int pthread_getattr_np(pthread_t t, pthread_attr_t *a)
a->_a_stackaddr = (uintptr_t)t->stack;
a->_a_stacksize = t->stack_size;
} else {
+#ifdef __wasilibc_unmodified_upstream
char *p = (void *)libc.auxv;
size_t l = PAGE_SIZE;
p += -(uintptr_t)p & PAGE_SIZE-1;
@@ -19,6 +22,9 @@ int pthread_getattr_np(pthread_t t, pthread_attr_t *a)
while (mremap(p-l-PAGE_SIZE, PAGE_SIZE, 2*PAGE_SIZE, 0)==MAP_FAILED && errno==ENOMEM)
l += PAGE_SIZE;
a->_a_stacksize = l;
+#else
+ return ENOSYS;
+#endif
}
return 0;
}