mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 11:14:58 +00:00
AK/StackInfo: Add support for OpenBSD pthreads
This commit is contained in:
parent
85287fcc1e
commit
c42e949f5b
1 changed files with 11 additions and 1 deletions
|
@ -14,7 +14,7 @@
|
||||||
# include <serenity.h>
|
# include <serenity.h>
|
||||||
#elif defined(AK_OS_LINUX) or defined(AK_OS_MACOS)
|
#elif defined(AK_OS_LINUX) or defined(AK_OS_MACOS)
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
#elif defined(AK_OS_FREEBSD)
|
#elif defined(AK_OS_FREEBSD) or defined(AK_OS_OPENBSD)
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
# include <pthread_np.h>
|
# include <pthread_np.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -67,6 +67,16 @@ StackInfo::StackInfo()
|
||||||
m_size = eight_megabytes;
|
m_size = eight_megabytes;
|
||||||
}
|
}
|
||||||
m_base = top_of_stack - m_size;
|
m_base = top_of_stack - m_size;
|
||||||
|
#elif defined(AK_OS_OPENBSD)
|
||||||
|
int rc;
|
||||||
|
stack_t thread_stack;
|
||||||
|
if ((rc = pthread_stackseg_np(pthread_self(), &thread_stack)) != 0) {
|
||||||
|
fprintf(stderr, "pthread_stackseg_np: %s\n", strerror(rc));
|
||||||
|
VERIFY_NOT_REACHED();
|
||||||
|
}
|
||||||
|
FlatPtr top_of_stack = (FlatPtr)thread_stack.ss_sp;
|
||||||
|
m_size = (size_t)thread_stack.ss_size;
|
||||||
|
m_base = top_of_stack - m_size;
|
||||||
#else
|
#else
|
||||||
# pragma message "StackInfo not supported on this platform! Recursion checks and stack scans may not work properly"
|
# pragma message "StackInfo not supported on this platform! Recursion checks and stack scans may not work properly"
|
||||||
m_size = (size_t)~0;
|
m_size = (size_t)~0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue