mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Merge pull request #2123 from jbeich/freebsd
Fix build on DragonFly and FreeBSD
This commit is contained in:
		
						commit
						946b62c03d
					
				
					 11 changed files with 68 additions and 37 deletions
				
			
		|  | @ -105,6 +105,15 @@ else() | ||||||
|     set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE) |     set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE) | ||||||
| endif() | endif() | ||||||
| 
 | 
 | ||||||
|  | # Set file offset size to 64 bits. | ||||||
|  | # | ||||||
|  | # On modern Unixes, this is typically already the case. The lone exception is | ||||||
|  | # glibc, which may default to 32 bits. glibc allows this to be configured | ||||||
|  | # by setting _FILE_OFFSET_BITS. | ||||||
|  | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||||||
|  |     add_definitions(-D_FILE_OFFSET_BITS=64) | ||||||
|  | endif() | ||||||
|  | 
 | ||||||
| add_definitions(-DSINGLETHREADED) | add_definitions(-DSINGLETHREADED) | ||||||
| # CMake seems to only define _DEBUG on Windows | # CMake seems to only define _DEBUG on Windows | ||||||
| set_property(DIRECTORY APPEND PROPERTY | set_property(DIRECTORY APPEND PROPERTY | ||||||
|  | @ -160,23 +169,30 @@ endif() | ||||||
| 
 | 
 | ||||||
| IF (APPLE) | IF (APPLE) | ||||||
|     FIND_LIBRARY(COCOA_LIBRARY Cocoa)           # Umbrella framework for everything GUI-related |     FIND_LIBRARY(COCOA_LIBRARY Cocoa)           # Umbrella framework for everything GUI-related | ||||||
|     set(PLATFORM_LIBRARIES iconv ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY}) |     set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY}) | ||||||
| 
 | 
 | ||||||
|     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") |     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") | ||||||
|     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") |     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") | ||||||
| ELSEIF(MINGW) | ELSEIF(MINGW) | ||||||
|     # GCC does not support codecvt, so use iconv instead |  | ||||||
|     # PSAPI is the Process Status API |     # PSAPI is the Process Status API | ||||||
|     set(PLATFORM_LIBRARIES winmm ws2_32 psapi iconv) |     set(PLATFORM_LIBRARIES winmm ws2_32 psapi) | ||||||
| 
 | 
 | ||||||
|     # WSAPoll functionality doesn't exist before WinNT 6.x (Vista and up) |     # WSAPoll functionality doesn't exist before WinNT 6.x (Vista and up) | ||||||
|     add_definitions(-D_WIN32_WINNT=0x0600) |     add_definitions(-D_WIN32_WINNT=0x0600) | ||||||
| ELSEIF(WIN32) | ELSEIF(WIN32) | ||||||
|     set(PLATFORM_LIBRARIES winmm ws2_32) |     set(PLATFORM_LIBRARIES winmm ws2_32) | ||||||
| ELSE() | ELSEIF(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU|SunOS)$") | ||||||
|     set(PLATFORM_LIBRARIES rt) |     set(PLATFORM_LIBRARIES rt) | ||||||
| ENDIF (APPLE) | ENDIF (APPLE) | ||||||
| 
 | 
 | ||||||
|  | # MINGW: GCC does not support codecvt, so use iconv instead | ||||||
|  | if (UNIX OR MINGW) | ||||||
|  |     find_library(ICONV_LIBRARY NAMES iconv) | ||||||
|  |     if (ICONV_LIBRARY) | ||||||
|  |         list(APPEND PLATFORM_LIBRARIES ${ICONV_LIBRARY}) | ||||||
|  |     endif() | ||||||
|  | endif() | ||||||
|  | 
 | ||||||
| if (ENABLE_QT) | if (ENABLE_QT) | ||||||
|     if (CITRA_USE_BUNDLED_QT) |     if (CITRA_USE_BUNDLED_QT) | ||||||
|         if (MSVC14 AND ARCHITECTURE_x86_64) |         if (MSVC14 AND ARCHITECTURE_x86_64) | ||||||
|  | @ -253,7 +269,7 @@ add_subdirectory(src) | ||||||
| # http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html | # http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html | ||||||
| # http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html | # http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html | ||||||
| # http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html | # http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html | ||||||
| if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") | if(ENABLE_QT AND UNIX AND NOT APPLE) | ||||||
|     install(FILES "${CMAKE_SOURCE_DIR}/dist/citra.desktop" |     install(FILES "${CMAKE_SOURCE_DIR}/dist/citra.desktop" | ||||||
|             DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications") |             DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications") | ||||||
|     install(FILES "${CMAKE_SOURCE_DIR}/dist/citra.svg" |     install(FILES "${CMAKE_SOURCE_DIR}/dist/citra.svg" | ||||||
|  |  | ||||||
							
								
								
									
										8
									
								
								externals/microprofile/microprofile.h
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								externals/microprofile/microprofile.h
									
										
									
									
										vendored
									
									
								
							|  | @ -206,7 +206,7 @@ int64_t MicroProfileGetTick(); | ||||||
| #define MP_GETCURRENTTHREADID() GetCurrentThreadId() | #define MP_GETCURRENTTHREADID() GetCurrentThreadId() | ||||||
| typedef uint32_t ThreadIdType; | typedef uint32_t ThreadIdType; | ||||||
| 
 | 
 | ||||||
| #elif defined(__linux__) | #elif !defined(_WIN32) | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #include <time.h> | #include <time.h> | ||||||
| inline int64_t MicroProfileTicksPerSecondCpu() | inline int64_t MicroProfileTicksPerSecondCpu() | ||||||
|  | @ -510,7 +510,7 @@ typedef int MpSocket; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| #if defined(__APPLE__) || defined(__linux__) | #ifndef _WIN32 | ||||||
| typedef pthread_t MicroProfileThread; | typedef pthread_t MicroProfileThread; | ||||||
| #elif defined(_WIN32) | #elif defined(_WIN32) | ||||||
| typedef HANDLE MicroProfileThread; | typedef HANDLE MicroProfileThread; | ||||||
|  | @ -907,7 +907,7 @@ int64_t MicroProfileGetTick() | ||||||
| 
 | 
 | ||||||
| typedef void* (*MicroProfileThreadFunc)(void*); | typedef void* (*MicroProfileThreadFunc)(void*); | ||||||
| 
 | 
 | ||||||
| #if defined(__APPLE__) || defined(__linux__) | #ifndef _WIN32 | ||||||
| typedef pthread_t MicroProfileThread; | typedef pthread_t MicroProfileThread; | ||||||
| void MicroProfileThreadStart(MicroProfileThread* pThread, MicroProfileThreadFunc Func) | void MicroProfileThreadStart(MicroProfileThread* pThread, MicroProfileThreadFunc Func) | ||||||
| { | { | ||||||
|  | @ -959,7 +959,7 @@ inline void MicroProfileThreadJoin(MicroProfileThread* pThread) | ||||||
| #define MP_INVALID_SOCKET(f) (f == INVALID_SOCKET) | #define MP_INVALID_SOCKET(f) (f == INVALID_SOCKET) | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #if defined(__APPLE__) | #ifndef _WIN32 | ||||||
| #include <sys/socket.h> | #include <sys/socket.h> | ||||||
| #include <netinet/in.h> | #include <netinet/in.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								externals/microprofile/microprofileui.h
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								externals/microprofile/microprofileui.h
									
										
									
									
										vendored
									
									
								
							|  | @ -172,6 +172,7 @@ MICROPROFILEUI_API void MicroProfileCustomGroupAddTimer(const char* pCustomName, | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| #define snprintf _snprintf | #define snprintf _snprintf | ||||||
| #endif | #endif | ||||||
|  | #include <stdio.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <stdarg.h> | #include <stdarg.h> | ||||||
| #include <math.h> | #include <math.h> | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| #!/bin/bash | #!/bin/sh | ||||||
| 
 | 
 | ||||||
| # Enforce citra's whitespace policy | # Enforce citra's whitespace policy | ||||||
| git config --local core.whitespace tab-in-indent,trailing-space | git config --local core.whitespace tab-in-indent,trailing-space | ||||||
|  | @ -32,7 +32,7 @@ for f in $(git diff --name-only --diff-filter=ACMRTUXB --cached); do | ||||||
|     if ! echo "$f" | egrep -q "^src/"; then |     if ! echo "$f" | egrep -q "^src/"; then | ||||||
|         continue |         continue | ||||||
|     fi |     fi | ||||||
|     d=$(diff -u "$f" <(clang-format "$f")) |     d=$(clang-format "$f" | diff -u "$f" -) | ||||||
|     if ! [ -z "$d" ]; then |     if ! [ -z "$d" ]; then | ||||||
|         echo "!!! $f not compliant to coding style, here is the fix:" |         echo "!!! $f not compliant to coding style, here is the fix:" | ||||||
|         echo "$d" |         echo "$d" | ||||||
|  | @ -40,4 +40,4 @@ for f in $(git diff --name-only --diff-filter=ACMRTUXB --cached); do | ||||||
|     fi |     fi | ||||||
| done | done | ||||||
| 
 | 
 | ||||||
| exit "$fail" | exit "${fail-0}" | ||||||
|  |  | ||||||
|  | @ -23,7 +23,7 @@ if (MSVC) | ||||||
| endif() | endif() | ||||||
| target_link_libraries(citra ${PLATFORM_LIBRARIES} Threads::Threads) | target_link_libraries(citra ${PLATFORM_LIBRARIES} Threads::Threads) | ||||||
| 
 | 
 | ||||||
| if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") | if(UNIX AND NOT APPLE) | ||||||
|     install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") |     install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") | ||||||
| endif() | endif() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -104,7 +104,7 @@ target_link_libraries(citra-qt core video_core audio_core common qhexedit) | ||||||
| target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) | target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) | ||||||
| target_link_libraries(citra-qt ${PLATFORM_LIBRARIES} Threads::Threads) | target_link_libraries(citra-qt ${PLATFORM_LIBRARIES} Threads::Threads) | ||||||
| 
 | 
 | ||||||
| if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") | if(UNIX AND NOT APPLE) | ||||||
|     install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") |     install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") | ||||||
| endif() | endif() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -23,8 +23,8 @@ | ||||||
| #define fseeko _fseeki64 | #define fseeko _fseeki64 | ||||||
| #define ftello _ftelli64 | #define ftello _ftelli64 | ||||||
| #define atoll _atoi64 | #define atoll _atoi64 | ||||||
| #define stat64 _stat64 | #define stat _stat64 | ||||||
| #define fstat64 _fstat64 | #define fstat _fstat64 | ||||||
| #define fileno _fileno | #define fileno _fileno | ||||||
| #else | #else | ||||||
| #ifdef __APPLE__ | #ifdef __APPLE__ | ||||||
|  | @ -52,11 +52,6 @@ | ||||||
| #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) | #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifdef BSD4_4 |  | ||||||
| #define stat64 stat |  | ||||||
| #define fstat64 fstat |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| // This namespace has various generic functions related to files and paths.
 | // This namespace has various generic functions related to files and paths.
 | ||||||
| // The code still needs a ton of cleanup.
 | // The code still needs a ton of cleanup.
 | ||||||
| // REMEMBER: strdup considered harmful!
 | // REMEMBER: strdup considered harmful!
 | ||||||
|  | @ -76,7 +71,7 @@ static void StripTailDirSlashes(std::string& fname) { | ||||||
| 
 | 
 | ||||||
| // Returns true if file filename exists
 | // Returns true if file filename exists
 | ||||||
| bool Exists(const std::string& filename) { | bool Exists(const std::string& filename) { | ||||||
|     struct stat64 file_info; |     struct stat file_info; | ||||||
| 
 | 
 | ||||||
|     std::string copy(filename); |     std::string copy(filename); | ||||||
|     StripTailDirSlashes(copy); |     StripTailDirSlashes(copy); | ||||||
|  | @ -88,7 +83,7 @@ bool Exists(const std::string& filename) { | ||||||
| 
 | 
 | ||||||
|     int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info); |     int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info); | ||||||
| #else | #else | ||||||
|     int result = stat64(copy.c_str(), &file_info); |     int result = stat(copy.c_str(), &file_info); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     return (result == 0); |     return (result == 0); | ||||||
|  | @ -96,7 +91,7 @@ bool Exists(const std::string& filename) { | ||||||
| 
 | 
 | ||||||
| // Returns true if filename is a directory
 | // Returns true if filename is a directory
 | ||||||
| bool IsDirectory(const std::string& filename) { | bool IsDirectory(const std::string& filename) { | ||||||
|     struct stat64 file_info; |     struct stat file_info; | ||||||
| 
 | 
 | ||||||
|     std::string copy(filename); |     std::string copy(filename); | ||||||
|     StripTailDirSlashes(copy); |     StripTailDirSlashes(copy); | ||||||
|  | @ -108,7 +103,7 @@ bool IsDirectory(const std::string& filename) { | ||||||
| 
 | 
 | ||||||
|     int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info); |     int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info); | ||||||
| #else | #else | ||||||
|     int result = stat64(copy.c_str(), &file_info); |     int result = stat(copy.c_str(), &file_info); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     if (result < 0) { |     if (result < 0) { | ||||||
|  | @ -339,11 +334,11 @@ u64 GetSize(const std::string& filename) { | ||||||
|         return 0; |         return 0; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     struct stat64 buf; |     struct stat buf; | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|     if (_wstat64(Common::UTF8ToUTF16W(filename).c_str(), &buf) == 0) |     if (_wstat64(Common::UTF8ToUTF16W(filename).c_str(), &buf) == 0) | ||||||
| #else | #else | ||||||
|     if (stat64(filename.c_str(), &buf) == 0) |     if (stat(filename.c_str(), &buf) == 0) | ||||||
| #endif | #endif | ||||||
|     { |     { | ||||||
|         LOG_TRACE(Common_Filesystem, "%s: %lld", filename.c_str(), (long long)buf.st_size); |         LOG_TRACE(Common_Filesystem, "%s: %lld", filename.c_str(), (long long)buf.st_size); | ||||||
|  | @ -356,8 +351,8 @@ u64 GetSize(const std::string& filename) { | ||||||
| 
 | 
 | ||||||
| // Overloaded GetSize, accepts file descriptor
 | // Overloaded GetSize, accepts file descriptor
 | ||||||
| u64 GetSize(const int fd) { | u64 GetSize(const int fd) { | ||||||
|     struct stat64 buf; |     struct stat buf; | ||||||
|     if (fstat64(fd, &buf) != 0) { |     if (fstat(fd, &buf) != 0) { | ||||||
|         LOG_ERROR(Common_Filesystem, "GetSize: stat failed %i: %s", fd, GetLastErrorMsg()); |         LOG_ERROR(Common_Filesystem, "GetSize: stat failed %i: %s", fd, GetLastErrorMsg()); | ||||||
|         return 0; |         return 0; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -21,7 +21,8 @@ | ||||||
| #include <cstdlib> | #include <cstdlib> | ||||||
| #elif defined(__linux__) | #elif defined(__linux__) | ||||||
| #include <byteswap.h> | #include <byteswap.h> | ||||||
| #elif defined(__FreeBSD__) | #elif defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) ||                     \ | ||||||
|  |     defined(__NetBSD__) || defined(__OpenBSD__) | ||||||
| #include <sys/endian.h> | #include <sys/endian.h> | ||||||
| #endif | #endif | ||||||
| #include <cstring> | #include <cstring> | ||||||
|  | @ -101,7 +102,9 @@ inline __attribute__((always_inline)) u32 swap32(u32 _data) { | ||||||
| inline __attribute__((always_inline)) u64 swap64(u64 _data) { | inline __attribute__((always_inline)) u64 swap64(u64 _data) { | ||||||
|     return __builtin_bswap64(_data); |     return __builtin_bswap64(_data); | ||||||
| } | } | ||||||
| #elif __FreeBSD__ | #elif defined(__Bitrig__) || defined(__OpenBSD__) | ||||||
|  | // swap16, swap32, swap64 are left as is
 | ||||||
|  | #elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) | ||||||
| inline u16 swap16(u16 _data) { | inline u16 swap16(u16 _data) { | ||||||
|     return bswap16(_data); |     return bswap16(_data); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ | ||||||
| #elif defined(_WIN32) | #elif defined(_WIN32) | ||||||
| #include <Windows.h> | #include <Windows.h> | ||||||
| #else | #else | ||||||
| #if defined(BSD4_4) || defined(__OpenBSD__) | #if defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) | ||||||
| #include <pthread_np.h> | #include <pthread_np.h> | ||||||
| #else | #else | ||||||
| #include <pthread.h> | #include <pthread.h> | ||||||
|  | @ -19,6 +19,10 @@ | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #ifdef __FreeBSD__ | ||||||
|  | #define cpu_set_t cpuset_t | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| namespace Common { | namespace Common { | ||||||
| 
 | 
 | ||||||
| int CurrentThreadId() { | int CurrentThreadId() { | ||||||
|  | @ -86,7 +90,7 @@ void SetCurrentThreadName(const char* szThreadName) { | ||||||
| void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) { | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) { | ||||||
| #ifdef __APPLE__ | #ifdef __APPLE__ | ||||||
|     thread_policy_set(pthread_mach_thread_np(thread), THREAD_AFFINITY_POLICY, (integer_t*)&mask, 1); |     thread_policy_set(pthread_mach_thread_np(thread), THREAD_AFFINITY_POLICY, (integer_t*)&mask, 1); | ||||||
| #elif (defined __linux__ || defined BSD4_4) && !(defined ANDROID) | #elif (defined __linux__ || defined __FreeBSD__) && !(defined ANDROID) | ||||||
|     cpu_set_t cpu_set; |     cpu_set_t cpu_set; | ||||||
|     CPU_ZERO(&cpu_set); |     CPU_ZERO(&cpu_set); | ||||||
| 
 | 
 | ||||||
|  | @ -117,8 +121,10 @@ void SwitchCurrentThread() { | ||||||
| void SetCurrentThreadName(const char* szThreadName) { | void SetCurrentThreadName(const char* szThreadName) { | ||||||
| #ifdef __APPLE__ | #ifdef __APPLE__ | ||||||
|     pthread_setname_np(szThreadName); |     pthread_setname_np(szThreadName); | ||||||
| #elif defined(__OpenBSD__) | #elif defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) | ||||||
|     pthread_set_name_np(pthread_self(), szThreadName); |     pthread_set_name_np(pthread_self(), szThreadName); | ||||||
|  | #elif defined(__NetBSD__) | ||||||
|  |     pthread_setname_np(pthread_self(), "%s", (void*)szThreadName); | ||||||
| #else | #else | ||||||
|     pthread_setname_np(pthread_self(), szThreadName); |     pthread_setname_np(pthread_self(), szThreadName); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -12,13 +12,15 @@ namespace Common { | ||||||
| 
 | 
 | ||||||
| #ifndef _MSC_VER | #ifndef _MSC_VER | ||||||
| 
 | 
 | ||||||
| #ifdef __FreeBSD__ | #if defined(__DragonFly__) || defined(__FreeBSD__) | ||||||
| #include <machine/cpufunc.h> | // clang-format off
 | ||||||
| #include <sys/types.h> | #include <sys/types.h> | ||||||
|  | #include <machine/cpufunc.h> | ||||||
|  | // clang-format on
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| static inline void __cpuidex(int info[4], int function_id, int subfunction_id) { | static inline void __cpuidex(int info[4], int function_id, int subfunction_id) { | ||||||
| #ifdef __FreeBSD__ | #if defined(__DragonFly__) || defined(__FreeBSD__) | ||||||
|     // Despite the name, this is just do_cpuid() with ECX as second input.
 |     // Despite the name, this is just do_cpuid() with ECX as second input.
 | ||||||
|     cpuid_count((u_int)function_id, (u_int)subfunction_id, (u_int*)info); |     cpuid_count((u_int)function_id, (u_int)subfunction_id, (u_int*)info); | ||||||
| #else | #else | ||||||
|  |  | ||||||
|  | @ -104,7 +104,9 @@ static const std::unordered_map<int, int> error_map = {{ | ||||||
|     {ERRNO(ENETUNREACH), 40}, |     {ERRNO(ENETUNREACH), 40}, | ||||||
|     {ENFILE, 41}, |     {ENFILE, 41}, | ||||||
|     {ERRNO(ENOBUFS), 42}, |     {ERRNO(ENOBUFS), 42}, | ||||||
|  | #ifdef ENODATA | ||||||
|     {ENODATA, 43}, |     {ENODATA, 43}, | ||||||
|  | #endif | ||||||
|     {ENODEV, 44}, |     {ENODEV, 44}, | ||||||
|     {ENOENT, 45}, |     {ENOENT, 45}, | ||||||
|     {ENOEXEC, 46}, |     {ENOEXEC, 46}, | ||||||
|  | @ -114,8 +116,12 @@ static const std::unordered_map<int, int> error_map = {{ | ||||||
|     {ENOMSG, 50}, |     {ENOMSG, 50}, | ||||||
|     {ERRNO(ENOPROTOOPT), 51}, |     {ERRNO(ENOPROTOOPT), 51}, | ||||||
|     {ENOSPC, 52}, |     {ENOSPC, 52}, | ||||||
|  | #ifdef ENOSR | ||||||
|     {ENOSR, 53}, |     {ENOSR, 53}, | ||||||
|  | #endif | ||||||
|  | #ifdef ENOSTR | ||||||
|     {ENOSTR, 54}, |     {ENOSTR, 54}, | ||||||
|  | #endif | ||||||
|     {ENOSYS, 55}, |     {ENOSYS, 55}, | ||||||
|     {ERRNO(ENOTCONN), 56}, |     {ERRNO(ENOTCONN), 56}, | ||||||
|     {ENOTDIR, 57}, |     {ENOTDIR, 57}, | ||||||
|  | @ -136,7 +142,9 @@ static const std::unordered_map<int, int> error_map = {{ | ||||||
|     {ESPIPE, 72}, |     {ESPIPE, 72}, | ||||||
|     {ESRCH, 73}, |     {ESRCH, 73}, | ||||||
|     {ERRNO(ESTALE), 74}, |     {ERRNO(ESTALE), 74}, | ||||||
|  | #ifdef ETIME | ||||||
|     {ETIME, 75}, |     {ETIME, 75}, | ||||||
|  | #endif | ||||||
|     {ERRNO(ETIMEDOUT), 76}, |     {ERRNO(ETIMEDOUT), 76}, | ||||||
| }}; | }}; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue