Chromium Code Reviews

Side by Side Diff: src/base/platform/platform-openbsd.cc

Issue 358363002: Move platform abstraction to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Platform-specific code for OpenBSD and NetBSD goes here. For the 5 // Platform-specific code for OpenBSD and NetBSD goes here. For the
6 // POSIX-compatible parts, the implementation is in platform-posix.cc. 6 // POSIX-compatible parts, the implementation is in platform-posix.cc.
7 7
8 #include <pthread.h> 8 #include <pthread.h>
9 #include <semaphore.h> 9 #include <semaphore.h>
10 #include <signal.h> 10 #include <signal.h>
11 #include <stdlib.h> 11 #include <stdlib.h>
12 #include <sys/resource.h> 12 #include <sys/resource.h>
13 #include <sys/syscall.h> 13 #include <sys/syscall.h>
14 #include <sys/time.h> 14 #include <sys/time.h>
15 #include <sys/types.h> 15 #include <sys/types.h>
16 16
17 #include <errno.h> 17 #include <errno.h>
18 #include <fcntl.h> // open 18 #include <fcntl.h> // open
19 #include <stdarg.h> 19 #include <stdarg.h>
20 #include <strings.h> // index 20 #include <strings.h> // index
21 #include <sys/mman.h> // mmap & munmap 21 #include <sys/mman.h> // mmap & munmap
22 #include <sys/stat.h> // open 22 #include <sys/stat.h> // open
23 #include <sys/types.h> // mmap & munmap 23 #include <sys/types.h> // mmap & munmap
24 #include <unistd.h> // sysconf 24 #include <unistd.h> // sysconf
25 25
26 #include <cmath> 26 #include <cmath>
27 27
28 #undef MAP_TYPE 28 #undef MAP_TYPE
29 29
30 #include "src/platform.h" 30 #include "src/base/macros.h"
31 #include "src/utils.h" 31 #include "src/base/platform/platform.h"
32 32
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace base {
36 36
37 37
38 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { 38 const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
39 if (std::isnan(time)) return ""; 39 if (std::isnan(time)) return "";
40 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); 40 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
41 struct tm* t = localtime(&tv); 41 struct tm* t = localtime(&tv);
42 if (NULL == t) return ""; 42 if (NULL == t) return "";
43 return t->tm_zone; 43 return t->tm_zone;
44 } 44 }
45 45
(...skipping 282 matching lines...)
328 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { 328 bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
329 return munmap(base, size) == 0; 329 return munmap(base, size) == 0;
330 } 330 }
331 331
332 332
333 bool VirtualMemory::HasLazyCommits() { 333 bool VirtualMemory::HasLazyCommits() {
334 // TODO(alph): implement for the platform. 334 // TODO(alph): implement for the platform.
335 return false; 335 return false;
336 } 336 }
337 337
338 } } // namespace v8::internal 338 } } // namespace v8::base
OLDNEW

Powered by Google App Engine