Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Unified Diff: runtime/vm/os_openbsd.cc

Issue 1559053002: Refs #10260 OpenBSD support #25327 Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Replace // FIXME with // TODO(mulander) Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a4da949a8d16b2d229f8f83ab6344b14ef3371f2 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";
}
@@ -395,7 +393,6 @@ int64_t OS::GetCurrentTimeMicros() {
return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec;
}
-
int64_t OS::GetCurrentMonotonicMicros() {
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
@@ -409,13 +406,12 @@ int64_t OS::GetCurrentMonotonicMicros() {
return result;
}
-
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;
@@ -551,7 +547,6 @@ int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) {
return retval;
}
-
Ivan Posva 2016/01/11 23:58:40 White space changes.
mulander 2016/01/12 00:22:46 Acknowledged.
char* OS::SCreate(Zone* zone, const char* format, ...) {
va_list args;
va_start(args, format);
@@ -560,7 +555,6 @@ char* OS::SCreate(Zone* zone, const char* format, ...) {
return buffer;
}
-
char* OS::VSCreate(Zone* zone, const char* format, va_list args) {
// Measure.
va_list measure_args;
@@ -584,7 +578,6 @@ char* OS::VSCreate(Zone* zone, const char* format, va_list args) {
return buffer;
}
-
bool OS::StringToInt64(const char* str, int64_t* value) {
ASSERT(str != NULL && strlen(str) > 0 && value != NULL);
int32_t base = 10;
@@ -653,4 +646,4 @@ void OS::Exit(int code) {
} // namespace dart
-#endif // defined(TARGET_OS_LINUX)
+#endif // defined(TARGET_OS_OPENBSD)

Powered by Google App Engine
This is Rietveld 408576698