Build on more Unix-like OSes (BSD, illumos, etc)

Signed-off-by: Nia Alarie <nia@NetBSD.org>
This commit is contained in:
nia 2024-10-25 10:39:25 +02:00
parent b9c5c4d8d3
commit e33c207043
2 changed files with 3 additions and 5 deletions

View file

@ -10,7 +10,7 @@
#elif TARGET_CPU_ARM64 #elif TARGET_CPU_ARM64
#define DENORM_AARCH64 #define DENORM_AARCH64
#endif #endif
#elif defined(__ANDROID__) || defined(__linux__) || defined(__FreeBSD__) #elif !defined(__EMSCRIPTEN__)
#if defined(__i386__) || defined(__x86_64__) #if defined(__i386__) || defined(__x86_64__)
#define DENORM_X86 #define DENORM_X86
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -8,7 +8,7 @@
#if defined(__APPLE__) #if defined(__APPLE__)
#include <sys/disk.h> #include <sys/disk.h>
#include <sys/stat.h> #include <sys/stat.h>
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) #else
#include <unistd.h> #include <unistd.h>
#include <sys/statvfs.h> #include <sys/statvfs.h>
#endif #endif
@ -29,15 +29,13 @@ CVolumeStream::CVolumeStream(const char* volumePath)
{ {
throw std::runtime_error("Can't get sector size."); throw std::runtime_error("Can't get sector size.");
} }
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) #else
struct statvfs s; struct statvfs s;
if(fstatvfs(m_fd, &s)) if(fstatvfs(m_fd, &s))
{ {
throw std::runtime_error("Can't get sector size."); throw std::runtime_error("Can't get sector size.");
} }
m_sectorSize = s.f_bsize; m_sectorSize = s.f_bsize;
#else
#error Unsupported
#endif #endif
m_cache = malloc(m_sectorSize); m_cache = malloc(m_sectorSize);
m_cacheSector = m_sectorSize - 1; m_cacheSector = m_sectorSize - 1;