vm_native: unbreak runtime on FreeBSD after 63104af8e9

shm_open() returns a file descriptor on success, not zero. As SHM_ANON
only exists on FreeBSD which also has memfd_create use the same code
as on Linux.

$ rpcs3
[...]
Verification failed (in file rpcs3/util/vm_native.cpp:478[:4], in function shm) (errno=2)
Segmentation fault
This commit is contained in:
Jan Beich 2021-10-11 22:26:52 +00:00 committed by Ivan
parent 3832d4fa1c
commit 1a90adfb5e

View File

@ -474,8 +474,9 @@ namespace utils
if ((vm_overcommit & 3) == 0)
{
#ifdef SHM_ANON
ensure(::shm_open(SHM_ANON, O_RDWR, S_IWUSR | S_IRUSR) == 0);
#if defined(__FreeBSD__)
m_file = ::memfd_create_("", 0);
ensure(m_file >= 0);
#else
const std::string name = "/rpcs3-mem2-" + std::to_string(reinterpret_cast<u64>(this));