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