Skip to content

Commit

Permalink
Merge pull request mrkite#123 from distalzou/fbsd-sysconf-fix
Browse files Browse the repository at this point in the history
Enable compilation on non-Linux unix such as FreeBSD
  • Loading branch information
mrkite authored Nov 29, 2017
2 parents 1232224 + d61e340 commit ececca1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion chunkcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ uint qHash(const ChunkID &c) {
ChunkCache::ChunkCache() {
int chunks = 10000; // 10% more than 1920x1200 blocks
#if defined(__unix__) || defined(__unix) || defined(unix)
#ifdef _SC_AVPHYS_PAGES
auto pages = sysconf(_SC_AVPHYS_PAGES);
auto page_size = sysconf(_SC_PAGE_SIZE);
chunks = (pages*page_size) / (sizeof(Chunk) + 16*sizeof(ChunkSection));
cache.setMaxCost(chunks);
#endif
#elif defined(_WIN32) || defined(WIN32)
MEMORYSTATUSEX status;
status.dwLength = sizeof(status);
Expand Down

0 comments on commit ececca1

Please sign in to comment.