Small fixes for OS::SignalCodeMovingGC on OpenBSD

This patch stores the result of sysconf() in a long integer and
checks the result of Free().

Change-Id: If77e46a2f188e6bc36ef2e98eac36bf7a7d67dff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1855942
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64263}
This commit is contained in:
David Carlier 2019-10-11 19:32:16 +01:00 committed by Commit Bot
parent da34e54e2e
commit 1b94fcac4d

View File

@ -107,7 +107,7 @@ void OS::SignalCodeMovingGC() {
// it. This injects a GC marker into the stream of events generated
// by the kernel and allows us to synchronize V8 code log and the
// kernel log.
int size = sysconf(_SC_PAGESIZE);
long size = sysconf(_SC_PAGESIZE); // NOLINT: type more fit than uint64_t
FILE* f = fopen(OS::GetGCFakeMMapFile(), "w+");
if (f == nullptr) {
OS::PrintError("Failed to open %s\n", OS::GetGCFakeMMapFile());
@ -116,7 +116,7 @@ void OS::SignalCodeMovingGC() {
void* addr =
mmap(NULL, size, PROT_READ | PROT_EXEC, MAP_PRIVATE, fileno(f), 0);
DCHECK(addr != MAP_FAILED);
OS::Free(addr, size);
CHECK(OS::Free(addr, size));
fclose(f);
}