diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 23c0149ca789bcdd34bc464590b1edc67398ddbf..87a8a8033c1eb519a8d0f100fdb0fee0295ea505 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -65,9 +65,9 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #pragma warning(default : 4214 4244) #endif -#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__)) -#if defined (__linux__) -#include <sys/vfs.h> +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (__linux__) || defined (__HAIKU__) +#include <sys/statvfs.h> #else #include <sys/param.h> #include <sys/mount.h> @@ -81,7 +81,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #endif #endif -#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (__HAIKU__)) +#if defined (__linux__) || defined (UNIXCOMMON) #ifndef NOTERMIOS #include <termios.h> #include <sys/ioctl.h> // ioctl @@ -96,8 +96,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #if defined (__unix__) || (defined (UNIXCOMMON) && !defined (__APPLE__)) #include <errno.h> #include <sys/wait.h> +#ifndef __HAIKU__ // haiku's crash dialog is just objectively better #define NEWSIGNALHANDLER #endif +#endif #ifndef NOMUMBLE #ifdef __linux__ // need -lrt @@ -374,7 +376,7 @@ void I_Sleep(UINT32 ms) void I_SleepDuration(precise_t duration) { -#if defined(__linux__) || defined(__FreeBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__) UINT64 precision = I_GetPrecisePrecision(); struct timespec ts = { .tv_sec = duration / precision, @@ -1226,18 +1228,13 @@ void I_ShutdownSystem(void) void I_GetDiskFreeSpace(INT64* freespace) { #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) -#if defined (SOLARIS) || defined (__HAIKU__) - *freespace = INT32_MAX; - return; -#else // Both Linux and BSD have this, apparently. - struct statfs stfs; - if (statfs(srb2home, &stfs) == -1) + struct statvfs stfs; + if (statvfs(srb2home, &stfs) == -1) { *freespace = INT32_MAX; return; } *freespace = stfs.f_bavail * stfs.f_bsize; -#endif #elif defined (_WIN32) static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL; static boolean testwin95 = false; diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 07088b9578c2df2923700e37ee17d99005b1faef..f787bbfbdc8c19a957db16a9635d9810eac603db 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -78,9 +78,9 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include "SDL_cpuinfo.h" #define HAVE_SDLCPUINFO -#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__)) -#if defined (__linux__) -#include <sys/vfs.h> +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (__linux__) || defined (__HAIKU__) +#include <sys/statvfs.h> #else #include <sys/param.h> #include <sys/mount.h> @@ -94,7 +94,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #endif #endif -#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (__HAIKU__)) +#if defined (__linux__) || defined (UNIXCOMMON) #ifndef NOTERMIOS #include <termios.h> #include <sys/ioctl.h> // ioctl @@ -109,8 +109,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #if defined (__unix__) || (defined (UNIXCOMMON) && !defined (__APPLE__)) #include <errno.h> #include <sys/wait.h> +#ifndef __HAIKU__ // haiku's crash dialog is just objectively better #define NEWSIGNALHANDLER #endif +#endif #ifndef NOMUMBLE #ifdef __linux__ // need -lrt @@ -2754,18 +2756,13 @@ void I_ShutdownSystem(void) void I_GetDiskFreeSpace(INT64 *freespace) { #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) -#if defined (SOLARIS) || defined (__HAIKU__) - *freespace = INT32_MAX; - return; -#else // Both Linux and BSD have this, apparently. - struct statfs stfs; - if (statfs(srb2home, &stfs) == -1) + struct statvfs stfs; + if (statvfs(srb2home, &stfs) == -1) { *freespace = INT32_MAX; return; } *freespace = stfs.f_bavail * stfs.f_bsize; -#endif #elif defined (_WIN32) static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL; static boolean testwin95 = false;