* Get the available memory for Haiku/BeOS

* Refactor the code a bit so the warning for missing code will be there for all the people that don't provide code.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1805 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2011-06-18 15:49:44 +00:00
parent 775c0e06ff
commit a28b5f6172

View File

@ -738,7 +738,7 @@ void Zoom_a_line(byte* original_line, byte* zoomed_line,
#elif defined(__macosx__) || defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/sysctl.h>
#elif defined(__BEOS__) || defined(__HAIKU__)
// sysinfo not implemented
#include <kernel/OS.h>
#elif defined(__AROS__) || defined(__amigaos4__) || defined(__MORPHOS__) || defined(__amigaos__)
#include <proto/exec.h>
#elif defined(__MINT__)
@ -784,17 +784,23 @@ unsigned long Memory_free(void)
len = sizeof(maxmem);
sysctl(mib,2,&maxmem,&len,NULL,0);
return maxmem;
#elif defined(__BEOS__) || defined(__HAIKU__) || defined(__SKYOS__) || defined(__amigaos4__) || defined(__TRU64__)
// No <sys/sysctl.h> on BeOS or Haiku
// AvailMem is misleading on os4 (os4 caches stuff in memory that you can still allocate)
#warning "There is missing code there for your platform ! please check and correct :)"
return 10*1024*1024;
#elif defined(__HAIKU__) || defined(__BEOS__)
int pages;
system_info systemInfo;
get_system_info(&systemInfo);
pages = systemInfo.max_pages - systemInfo.used_pages;
return pages * B_PAGE_SIZE;
#elif defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
return AvailMem(MEMF_ANY);
#else
#elif defined(__linux__)
struct sysinfo info;
sysinfo(&info);
return info.freeram*info.mem_unit;
#else
// AvailMem is misleading on os4 (os4 caches stuff in memory that you can still allocate)
#warning "There is missing code there for your platform ! please check and correct :)"
return 10*1024*1024;
#endif
}
#endif