diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index d3fe1a997f..20f5a368f4 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c @@ -25,14 +25,8 @@ #include #include #include -#ifdef __FreeBSD__ -#include -#include -#elif defined(__APPLE__) -#include -#include -#elif !defined(WIN32) -#include +#ifndef WIN32 +#include #endif #ifdef WIN32 @@ -472,15 +466,15 @@ void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free) *free = free_clusters * secperclus / 2 * (bytespersec / 512); } #else - struct statfs fs; + struct statvfs vfs; - if (!statfs(".", &fs)) { - DEBUGF("statfs: bsize=%d blocks=%ld free=%ld\n", - (int)fs.f_bsize, fs.f_blocks, fs.f_bfree); + if (!statvfs(".", &vfs)) { + DEBUGF("statvfs: frsize=%d blocks=%ld free=%ld\n", + (int)vfs.f_frsize, (long)vfs.f_blocks, (long)vfs.f_bfree); if (size) - *size = fs.f_blocks * (fs.f_bsize / 1024); + *size = vfs.f_blocks / 2 * (vfs.f_frsize / 512); if (free) - *free = fs.f_bfree * (fs.f_bsize / 1024); + *free = vfs.f_bfree / 2 * (vfs.f_frsize / 512); } #endif else {