Skip to content

Commit

Permalink
Fix to unbreak SDL_GetSystemRAM() on FreeBSD
Browse files Browse the repository at this point in the history
Marcus von Appen

Revision eecbcfed77c9 of the SDL hg repo introduces the new
SDL_GetSystemRAM() function, which breaks the build on FreeBSD. Find
attached a patch, which unbreaks the build and also should (for most
cases) properly implement the sysctl support it.
  • Loading branch information
slouken committed Oct 18, 2013
1 parent 14e13e1 commit 95dc994
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/cpuinfo/SDL_cpuinfo.c
Expand Up @@ -620,7 +620,16 @@ SDL_GetSystemRAM(void)
#endif
#ifdef HAVE_SYSCTLBYNAME
if (SDL_SystemRAM <= 0) {
#ifdef __FreeBSD__
#ifdef HW_REALMEM
int mib[2] = {CTL_HW, HW_REALMEM};
#else
/* might only report up to 2 GiB */
int mib[2] = {CTL_HW, HW_PHYSMEM};
#endif /* HW_REALMEM */
#else
int mib[2] = {CTL_HW, HW_MEMSIZE};
#endif /* __FreeBSD__ */
Uint64 memsize = 0;
size_t len = sizeof(memsize);

Expand Down

0 comments on commit 95dc994

Please sign in to comment.