| Index: runtime/vm/os_openbsd.cc
|
| diff --git a/runtime/vm/os_linux.cc b/runtime/vm/os_openbsd.cc
|
| similarity index 98%
|
| copy from runtime/vm/os_linux.cc
|
| copy to runtime/vm/os_openbsd.cc
|
| index 7924be1cfcd7460c55309f25096ddd8021c0ecc7..844ccba601a2b8ace0791f89b5551922ac775388 100644
|
| --- a/runtime/vm/os_linux.cc
|
| +++ b/runtime/vm/os_openbsd.cc
|
| @@ -3,18 +3,17 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| #include "vm/globals.h"
|
| -#if defined(TARGET_OS_LINUX)
|
| +#if defined(TARGET_OS_OPENBSD)
|
|
|
| #include "vm/os.h"
|
|
|
| #include <errno.h> // NOLINT
|
| #include <limits.h> // NOLINT
|
| -#include <malloc.h> // NOLINT
|
| +#include <stdlib.h> // NOLINT
|
| #include <time.h> // NOLINT
|
| #include <sys/resource.h> // NOLINT
|
| #include <sys/time.h> // NOLINT
|
| #include <sys/types.h> // NOLINT
|
| -#include <sys/syscall.h> // NOLINT
|
| #include <sys/stat.h> // NOLINT
|
| #include <fcntl.h> // NOLINT
|
| #include <unistd.h> // NOLINT
|
| @@ -259,9 +258,8 @@ class JitdumpCodeObserver : public CodeObserver {
|
| }
|
|
|
| pid_t gettid() {
|
| - // libc doesn't wrap the Linux-specific gettid system call.
|
| // Note that this thread id is not the same as the posix thread id.
|
| - return syscall(SYS_gettid);
|
| + return getthrid();
|
| }
|
|
|
| uint64_t GetKernelTimeNanos() {
|
| @@ -337,7 +335,7 @@ class JitdumpCodeObserver : public CodeObserver {
|
|
|
|
|
| const char* OS::Name() {
|
| - return "linux";
|
| + return "openbsd";
|
| }
|
|
|
|
|
| @@ -414,8 +412,8 @@ void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) {
|
| const int kMinimumAlignment = 16;
|
| ASSERT(Utils::IsPowerOfTwo(alignment));
|
| ASSERT(alignment >= kMinimumAlignment);
|
| - void* p = memalign(alignment, size);
|
| - if (p == NULL) {
|
| + void* p = NULL;
|
| + if (posix_memalign(&p, alignment, size)) {
|
| UNREACHABLE();
|
| }
|
| return p;
|
| @@ -653,4 +651,4 @@ void OS::Exit(int code) {
|
|
|
| } // namespace dart
|
|
|
| -#endif // defined(TARGET_OS_LINUX)
|
| +#endif // defined(TARGET_OS_OPENBSD)
|
|
|