mirror of https://github.com/PCSX2/pcsx2.git
Fix shm_open(3) call on FreeBSD
On FreeBSD, shm_open(3) requires name to start with a '/', else EINVAL is returned. See: https://www.freebsd.org/cgi/man.cgi?shm_open
This commit is contained in:
parent
6ad98e2c70
commit
67f1cd4e15
|
@ -153,7 +153,12 @@ void HostSys::MemProtect(void* baseaddr, size_t size, const PageProtectionMode&
|
||||||
std::string HostSys::GetFileMappingName(const char* prefix)
|
std::string HostSys::GetFileMappingName(const char* prefix)
|
||||||
{
|
{
|
||||||
const unsigned pid = static_cast<unsigned>(getpid());
|
const unsigned pid = static_cast<unsigned>(getpid());
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
// FreeBSD's shm_open(3) requires name to be absolute
|
||||||
|
return fmt::format("/tmp/{}_{}", prefix, pid);
|
||||||
|
#else
|
||||||
return fmt::format("{}_{}", prefix, pid);
|
return fmt::format("{}_{}", prefix, pid);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* HostSys::CreateSharedMemory(const char* name, size_t size)
|
void* HostSys::CreateSharedMemory(const char* name, size_t size)
|
||||||
|
|
Loading…
Reference in New Issue