fix android build
Some checks failed
Formatting check / formatting-check (push) Has been cancelled
Build RPCSX / build-linux (push) Has been cancelled
Build RPCSX / build-android (arm64-v8a, armv8-a) (push) Has been cancelled
Build RPCSX / build-android (arm64-v8a, armv8.1-a) (push) Has been cancelled
Build RPCSX / build-android (arm64-v8a, armv8.2-a) (push) Has been cancelled
Build RPCSX / build-android (arm64-v8a, armv8.4-a) (push) Has been cancelled
Build RPCSX / build-android (arm64-v8a, armv8.5-a) (push) Has been cancelled
Build RPCSX / build-android (arm64-v8a, armv9-a) (push) Has been cancelled
Build RPCSX / build-android (arm64-v8a, armv9.1-a) (push) Has been cancelled
Build RPCSX / build-android (x86_64, x86-64) (push) Has been cancelled

This commit is contained in:
DH 2025-10-17 02:43:13 +03:00
parent 3ffece2d77
commit 390dadf78e
2 changed files with 7 additions and 11 deletions

View file

@ -4,7 +4,7 @@
#include "EnumBitSet.hpp"
#include <cstddef>
#include <system_error>
#include <utility>
#include <vector>
namespace rx::mem {
enum class Protection {

View file

@ -15,7 +15,12 @@
#endif
#ifdef ANDROID
#include "format-base.hpp"
#include <sys/syscall.h>
static int memfd_create(const char *name, uint flags) {
// FIXME: requires modern android
return syscall(__NR_memfd_create, name, flags);
}
#endif
std::pair<rx::Mappable, std::errc>
@ -32,22 +37,13 @@ rx::Mappable::CreateMemory(std::size_t size) {
}
result.m_handle = handle;
#else
#ifdef ANDROID
auto name = rx::format("/{}-{:x}", (void *)&result, size);
auto fd = ::shm_open(name.c_str(), O_CREAT | O_TRUNC, 0666);
#else
auto fd = ::memfd_create("", 0);
#endif
if (fd < 0) {
return {{}, std::errc{errno}};
}
#ifdef ANDROID
::shm_unlink(name.c_str());
#endif
result.m_handle = fd;
if (::ftruncate(fd, size) < 0) {