[memory linux] Properly unlink shared memory

shm_unlink(name) is the proper way to close a shared memory in linux.
Prior to this, xenia was creating and not cleaning up shared memory handle
which would accumulate in /dev/shm. shm_unlink is the proper way of doing
this.
Add filename to CloseFileMappingHandle signature.
Add simple test to open and close.
This commit is contained in:
Sandy Carter
2019-07-11 09:44:42 -04:00
committed by Triang3l
parent 2c7009ca80
commit 49e194009b
6 changed files with 15 additions and 9 deletions

View File

@@ -422,7 +422,7 @@ TEST_CASE("create_and_close_file_mapping", "Virtual Memory Mapping") {
auto memory = xe::memory::CreateFileMappingHandle(
path, 0x100, xe::memory::PageAccess::kReadWrite, true);
REQUIRE(memory);
xe::memory::CloseFileMappingHandle(memory);
xe::memory::CloseFileMappingHandle(memory, path);
}
TEST_CASE("map_view", "Virtual Memory Mapping") {
@@ -439,7 +439,7 @@ TEST_CASE("map_view", "Virtual Memory Mapping") {
REQUIRE(reinterpret_cast<uintptr_t>(view) == address);
xe::memory::UnmapFileView(memory, reinterpret_cast<void*>(address), length);
xe::memory::CloseFileMappingHandle(memory);
xe::memory::CloseFileMappingHandle(memory, path);
}
TEST_CASE("read_write_view", "Virtual Memory Mapping") {
@@ -466,7 +466,7 @@ TEST_CASE("read_write_view", "Virtual Memory Mapping") {
}
xe::memory::UnmapFileView(memory, reinterpret_cast<void*>(address), length);
xe::memory::CloseFileMappingHandle(memory);
xe::memory::CloseFileMappingHandle(memory, path);
}
} // namespace test