mirror of
				https://git.suyu.dev/suyu/suyu.git
				synced 2025-10-31 23:06:43 +08:00 
			
		
		
		
	Merge pull request #6758 from jbeich/fastmem
host_memory: enable fastmem on FreeBSD
This commit is contained in:
		
						commit
						f771d92e44
					
				| @ -6,7 +6,7 @@ | |||||||
| #include <windows.h> | #include <windows.h> | ||||||
| #include "common/dynamic_library.h" | #include "common/dynamic_library.h" | ||||||
| 
 | 
 | ||||||
| #elif defined(__linux__) // ^^^ Windows ^^^ vvv Linux vvv
 | #elif defined(__linux__) || defined(__FreeBSD__) // ^^^ Windows ^^^ vvv Linux vvv
 | ||||||
| 
 | 
 | ||||||
| #ifndef _GNU_SOURCE | #ifndef _GNU_SOURCE | ||||||
| #define _GNU_SOURCE | #define _GNU_SOURCE | ||||||
| @ -343,7 +343,7 @@ private: | |||||||
|     std::unordered_map<size_t, size_t> placeholder_host_pointers; ///< Placeholder backing offset
 |     std::unordered_map<size_t, size_t> placeholder_host_pointers; ///< Placeholder backing offset
 | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #elif defined(__linux__) // ^^^ Windows ^^^ vvv Linux vvv
 | #elif defined(__linux__) || defined(__FreeBSD__) // ^^^ Windows ^^^ vvv Linux vvv
 | ||||||
| 
 | 
 | ||||||
| class HostMemory::Impl { | class HostMemory::Impl { | ||||||
| public: | public: | ||||||
| @ -357,7 +357,12 @@ public: | |||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         // Backing memory initialization
 |         // Backing memory initialization
 | ||||||
|  | #if defined(__FreeBSD__) && __FreeBSD__ < 13 | ||||||
|  |         // XXX Drop after FreeBSD 12.* reaches EOL on 2024-06-30
 | ||||||
|  |         fd = shm_open(SHM_ANON, O_RDWR, 0600); | ||||||
|  | #else | ||||||
|         fd = memfd_create("HostMemory", 0); |         fd = memfd_create("HostMemory", 0); | ||||||
|  | #endif | ||||||
|         if (fd == -1) { |         if (fd == -1) { | ||||||
|             LOG_CRITICAL(HW_Memory, "memfd_create failed: {}", strerror(errno)); |             LOG_CRITICAL(HW_Memory, "memfd_create failed: {}", strerror(errno)); | ||||||
|             throw std::bad_alloc{}; |             throw std::bad_alloc{}; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user