src/cpuinfo/SDL_cpuinfo.c
changeset 8240 334257cd613d
parent 8149 681eb46b8ac4
child 8241 b6d5a589ce3f
equal deleted inserted replaced
8239:05cbb1cb4f27 8240:334257cd613d
   651             SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024*1024));
   651             SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024*1024));
   652         }
   652         }
   653 #endif
   653 #endif
   654 #ifdef HAVE_SYSCTLBYNAME
   654 #ifdef HAVE_SYSCTLBYNAME
   655         if (SDL_SystemRAM <= 0) {
   655         if (SDL_SystemRAM <= 0) {
   656 #ifdef __FreeBSD__
   656 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
   657 #ifdef HW_REALMEM
   657 #ifdef HW_REALMEM
   658             int mib[2] = {CTL_HW, HW_REALMEM};
   658             int mib[2] = {CTL_HW, HW_REALMEM};
   659 #else
   659 #else
   660             /* might only report up to 2 GiB */
   660             /* might only report up to 2 GiB */
   661             int mib[2] = {CTL_HW, HW_PHYSMEM};
   661             int mib[2] = {CTL_HW, HW_PHYSMEM};
   662 #endif /* HW_REALMEM */
   662 #endif /* HW_REALMEM */
   663 #else
   663 #else
   664             int mib[2] = {CTL_HW, HW_MEMSIZE};
   664             int mib[2] = {CTL_HW, HW_MEMSIZE};
   665 #endif /* __FreeBSD__ */
   665 #endif /* __FreeBSD__ || __FreeBSD_kernel__ */
   666             Uint64 memsize = 0;
   666             Uint64 memsize = 0;
   667             size_t len = sizeof(memsize);
   667             size_t len = sizeof(memsize);
   668             
   668             
   669             if (sysctl(mib, 2, &memsize, &len, NULL, 0) == 0) {
   669             if (sysctl(mib, 2, &memsize, &len, NULL, 0) == 0) {
   670                 SDL_SystemRAM = (int)(memsize / (1024*1024));
   670                 SDL_SystemRAM = (int)(memsize / (1024*1024));