Skip to content

Commit

Permalink
android pls
Browse files Browse the repository at this point in the history
  • Loading branch information
wheremyfoodat committed Nov 30, 2024
1 parent a576467 commit ec13e1c
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions third_party/host_memory/host_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
#define ARCHITECTURE_arm64
#endif

#ifndef __ANDROID__
#define USING_FD
#endif

#ifdef _WIN32

#include <windows.h>
Expand Down Expand Up @@ -38,15 +34,12 @@
#define MAP_NORESERVE 0
#endif

#endif // ^^^ Linux ^^^

#ifdef USING_FD
#define MAYBE_ANONYMOUS(flags) (flags)
#else
#define MAYBE_ANONYMOUS(flags) (flags) | MAP_ANONYMOUS
#ifdef __ANDROID__
#include <android/sharedmem.h>
#endif

#endif // ^^^ Linux ^^^

#include <cstring>
#include <mutex>
#include <random>
Expand Down Expand Up @@ -448,10 +441,10 @@ namespace Common {
#if defined(__FreeBSD__) && __FreeBSD__ < 13
// XXX Drop after FreeBSD 12.* reaches EOL on 2024-06-30
fd = shm_open(SHM_ANON, O_RDWR, 0600);
#elif defined(USING_FD)
#elif defined(__ANDROID__)
fd = memfd_create("HostMemory", 0);
#else
fd = -1;
fd = ASharedMemory_create("HostMemory", 0);
#endif

#ifdef USING_FD
Expand Down

0 comments on commit ec13e1c

Please sign in to comment.