Skip to content

Commit

Permalink
Support OpenBSD (#372)
Browse files Browse the repository at this point in the history
Co-authored-by: Marcel Laverdet <[email protected]>
  • Loading branch information
fpedrei and laverdet authored Jul 22, 2023
1 parent acf59e4 commit a312cc6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/isolate/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ static auto GetStackBase() -> void* {
pthread_t self = pthread_self();
return (void*)((char*)pthread_get_stackaddr_np(self) - pthread_get_stacksize_np(self));
}
#elif defined __OpenBSD__
#include <pthread_np.h>
static auto GetStackBase() -> void* {
pthread_t self = pthread_self();
stack_t ss;
void* base = nullptr;
if (pthread_stackseg_np(self, &ss) == 0) {
base = (void*)((char*)ss.ss_sp - ss.ss_size);
}
return base;
#elif defined __FreeBSD__
#include <pthread_np.h>
static auto GetStackBase() -> void* {
Expand Down

0 comments on commit a312cc6

Please sign in to comment.