[memory] Move "Local\\" prefix to win impl
CreateFileMappingHandle now takes shared memory name without a prefix. The doc of shm_open recommends not using slashes and prefixing with "/". The prefixing has been moved to the os implementation layer. Invocations of CreateFileMappingHandle were all using "Local\\" so these prefixes were removed.
This commit is contained in:
parent
0beed6a9b6
commit
cbbb69273c
|
@ -87,7 +87,8 @@ FileMappingHandle CreateFileMappingHandle(std::wstring path, size_t length,
|
|||
}
|
||||
|
||||
oflag |= O_CREAT;
|
||||
int ret = shm_open(xe::to_string(path).c_str(), oflag, 0777);
|
||||
std::string full_path = "/" + xe::to_string(path);
|
||||
int ret = shm_open(full_path.c_str(), oflag, 0777);
|
||||
if (ret > 0) {
|
||||
ftruncate64(ret, length);
|
||||
}
|
||||
|
|
|
@ -146,9 +146,10 @@ FileMappingHandle CreateFileMappingHandle(std::wstring path, size_t length,
|
|||
PageAccess access, bool commit) {
|
||||
DWORD protect =
|
||||
ToWin32ProtectFlags(access) | (commit ? SEC_COMMIT : SEC_RESERVE);
|
||||
std::wstring full_path = L"Local\\" + path;
|
||||
return CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, protect,
|
||||
static_cast<DWORD>(length >> 32),
|
||||
static_cast<DWORD>(length), path.c_str());
|
||||
static_cast<DWORD>(length), full_path.c_str());
|
||||
}
|
||||
|
||||
void CloseFileMappingHandle(FileMappingHandle handle) { CloseHandle(handle); }
|
||||
|
|
|
@ -61,7 +61,7 @@ bool X64CodeCache::Initialize() {
|
|||
}
|
||||
|
||||
// Create mmap file. This allows us to share the code cache with the debugger.
|
||||
file_name_ = std::wstring(L"Local\\xenia_code_cache_") +
|
||||
file_name_ = std::wstring(L"xenia_code_cache_") +
|
||||
std::to_wstring(Clock::QueryHostTickCount());
|
||||
mapping_ = xe::memory::CreateFileMappingHandle(
|
||||
file_name_, kGeneratedCodeSize, xe::memory::PageAccess::kExecuteReadWrite,
|
||||
|
|
|
@ -122,7 +122,7 @@ Memory::~Memory() {
|
|||
}
|
||||
|
||||
bool Memory::Initialize() {
|
||||
file_name_ = std::wstring(L"Local\\xenia_memory_") +
|
||||
file_name_ = std::wstring(L"xenia_memory_") +
|
||||
std::to_wstring(Clock::QueryHostTickCount());
|
||||
|
||||
// Create main page file-backed mapping. This is all reserved but
|
||||
|
|
Loading…
Reference in New Issue