13#include <sys/resource.h>
16#include <sys/ucontext.h>
22#include <sys/sysctl.h>
43 return new PosixDefaultTimezoneCache();
47 return static_cast<unsigned>(strtol(buffer,
nullptr, 16));
51 std::vector<SharedLibraryAddress>
result;
52 int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()};
53 size_t miblen =
sizeof(mib) /
sizeof(mib[0]);
55 if (sysctl(mib, miblen,
nullptr, &buffer_size,
nullptr, 0) == 0) {
59 buffer_size = buffer_size * 4 / 3;
60 std::vector<char> buffer(buffer_size);
61 int ret = sysctl(mib, miblen, buffer.data(), &buffer_size,
nullptr, 0);
63 if (ret == 0 || (ret == -1 && errno == ENOMEM)) {
64 char*
start = buffer.data();
68 struct kinfo_vmentry* map =
69 reinterpret_cast<struct kinfo_vmentry*
>(
start);
70 const size_t ssize = map->kve_structsize;
71 char* path = map->kve_path;
75 if ((map->kve_protection & KVME_PROT_READ) != 0 &&
76 (map->kve_protection & KVME_PROT_EXEC) != 0 && path[0] !=
'\0') {
77 char* sep = strrchr(path,
'/');
80 lib_name = std::string(++sep);
82 lib_name = std::string(path);
84 result.push_back(SharedLibraryAddress(
85 lib_name,
reinterpret_cast<uintptr_t
>(map->kve_start),
86 reinterpret_cast<uintptr_t
>(map->kve_end)));
110 pthread_attr_init(&attr);
111 error = pthread_attr_get_np(pthread_self(), &attr);
115 error = pthread_attr_getstack(&attr, &
base, &size);
117 pthread_attr_destroy(&attr);
118 return reinterpret_cast<uint8_t*
>(
base) + size;
120 pthread_attr_destroy(&attr);
static void SignalCodeMovingGC()
static std::vector< SharedLibraryAddress > GetSharedLibraryAddresses()
static TimezoneCache * CreateTimezoneCache()
static std::optional< MemoryRange > GetFirstFreeMemoryRangeWithin(Address boundary_start, Address boundary_end, size_t minimum_size, size_t alignment)
static void AdjustSchedulingParams()
static Stack::StackSlot ObtainCurrentThreadStackStart()
ZoneVector< RpoNumber > & result
static unsigned StringToLong(char *buffer)
#define CHECK_NE(lhs, rhs)