Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
wheremyfoodat committed Dec 1, 2024
1 parent b98d009 commit 1c0c17a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions third_party/host_memory/host_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
#define MAP_NORESERVE 0
#endif

// On Android, include ioctl for the shared memory ioctls
// On Android, include ioctl for shared memory ioctls, dlfcn for loading libandroid and linux/ashmem for ashmem defines
#ifdef __ANDROID__
#include <dlfcn.h>
#include <linux/ashmem.h>
#include <sys/ioctl.h>
#endif

Expand Down Expand Up @@ -491,7 +493,7 @@ namespace Common {
throw std::bad_alloc{};
}

backing_base = static_cast<u8*>(mmap(nullptr, backing_size, PROT_READ | PROT_WRITE, MAYBE_ANONYMOUS(MAP_SHARED), fd, 0));
backing_base = static_cast<u8*>(mmap(nullptr, backing_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));

if (backing_base == MAP_FAILED) {
Helpers::warn("mmap failed: {}", strerror(errno));
Expand Down Expand Up @@ -535,7 +537,7 @@ namespace Common {
}
#endif

void* ret = mmap(virtual_base + virtual_offset, length, flags, MAYBE_ANONYMOUS(MAP_SHARED | MAP_FIXED), fd, host_offset);
void* ret = mmap(virtual_base + virtual_offset, length, flags, MAP_SHARED | MAP_FIXED, fd, host_offset);
ASSERT_MSG(ret != MAP_FAILED, "mmap failed: {}", strerror(errno));
}

Expand Down

0 comments on commit 1c0c17a

Please sign in to comment.