osx : fix syscalls

This commit is contained in:
hymei
2022-06-05 01:13:13 +03:00
committed by nillerusr
parent c7308906d1
commit 3291cdf978
16 changed files with 92 additions and 32 deletions
+8
View File
@@ -30,6 +30,8 @@
#ifdef OSX
#include <Carbon/Carbon.h>
#include <sys/param.h>
#include <sys/mount.h>
#elif defined(LINUX)
#include <sys/vfs.h>
#endif
@@ -583,8 +585,14 @@ int CSystem::GetAvailableDrives(char *buf, int bufLen)
//-----------------------------------------------------------------------------
double CSystem::GetFreeDiskSpace(const char *path)
{
#if __DARWIN_ONLY_64_BIT_INO_T
// MoeMod: newer macOS only support 64bit, so no statfs64 is provided
struct statfs buf;
int ret = statfs( path, &buf );
#else
struct statfs64 buf;
int ret = statfs64( path, &buf );
#endif
if ( ret < 0 )
return 0.0;
return (double) ( buf.f_bsize * buf.f_bfree );