V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
platform-solaris.cc
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
3 // found in the LICENSE file.
4 
5 // Platform-specific code for Solaris 10 goes here. For the POSIX-compatible
6 // parts, the implementation is in platform-posix.cc.
7 
8 #ifdef __sparc
9 # error "V8 does not support the SPARC CPU architecture."
10 #endif
11 
12 #include <dlfcn.h> // dladdr
13 #include <errno.h>
14 #include <ieeefp.h> // finite()
15 #include <pthread.h>
16 #include <semaphore.h>
17 #include <signal.h> // sigemptyset(), etc
18 #include <sys/mman.h> // mmap()
19 #include <sys/regset.h>
20 #include <sys/stack.h> // for stack alignment
21 #include <sys/time.h> // gettimeofday(), timeradd()
22 #include <time.h>
23 #include <ucontext.h> // walkstack(), getcontext()
24 #include <unistd.h> // getpagesize(), usleep()
25 
26 #include <cmath>
27 
28 #undef MAP_TYPE
29 
30 #include "src/base/macros.h"
31 #include "src/base/platform/platform-posix.h"
32 #include "src/base/platform/platform.h"
33 
34 namespace v8 {
35 namespace base {
36 
38  const char* LocalTimezone(double time) override;
39 
40  double LocalTimeOffset(double time, bool is_utc) override;
41  ~SolarisTimezoneCache() override {}
42 };
43 
44 const char* SolarisTimezoneCache::LocalTimezone(double time) {
45  if (std::isnan(time)) return "";
46  time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
47  struct tm tm;
48  struct tm* t = localtime_r(&tv, &tm);
49  if (nullptr == t) return "";
50  return tzname[0]; // The location of the timezone string on Solaris.
51 }
52 
53 double SolarisTimezoneCache::LocalTimeOffset(double time, bool is_utc) {
54  tzset();
55  return -static_cast<double>(timezone * msPerSecond);
56 }
57 
58 TimezoneCache* OS::CreateTimezoneCache() { return new SolarisTimezoneCache(); }
59 
60 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
61  return std::vector<SharedLibraryAddress>();
62 }
63 
64 void OS::SignalCodeMovingGC() {}
65 
66 } // namespace base
67 } // namespace v8
Definition: libplatform.h:13