src/cpuinfo/SDL_cpuinfo.c
changeset 7826 a87057441d01
parent 7823 4ab3a5ee041d
child 7828 1451063c8ecd
equal deleted inserted replaced
7825:10be1bae0f7a 7826:a87057441d01
   618             SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024*1024));
   618             SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024*1024));
   619         }
   619         }
   620 #endif
   620 #endif
   621 #ifdef HAVE_SYSCTLBYNAME
   621 #ifdef HAVE_SYSCTLBYNAME
   622         if (SDL_SystemRAM <= 0) {
   622         if (SDL_SystemRAM <= 0) {
       
   623 #ifdef __FreeBSD__
       
   624 #ifdef HW_REALMEM
       
   625             int mib[2] = {CTL_HW, HW_REALMEM};
       
   626 #else
       
   627             /* might only report up to 2 GiB */
       
   628             int mib[2] = {CTL_HW, HW_PHYSMEM};
       
   629 #endif /* HW_REALMEM */
       
   630 #else
   623             int mib[2] = {CTL_HW, HW_MEMSIZE};
   631             int mib[2] = {CTL_HW, HW_MEMSIZE};
       
   632 #endif /* __FreeBSD__ */
   624             Uint64 memsize = 0;
   633             Uint64 memsize = 0;
   625             size_t len = sizeof(memsize);
   634             size_t len = sizeof(memsize);
   626             
   635             
   627             if (sysctl(mib, 2, &memsize, &len, NULL, 0) == 0) {
   636             if (sysctl(mib, 2, &memsize, &len, NULL, 0) == 0) {
   628                 SDL_SystemRAM = (int)(memsize / (1024*1024));
   637                 SDL_SystemRAM = (int)(memsize / (1024*1024));