The _SC_PHYS_PAGES method of calculating RAM works on Linux.
authorSam Lantinga <slouken@libsdl.org>
Thu, 17 Oct 2013 11:32:14 -0700
changeset 7822 6bd98963606b
parent 7821 c47ae79f0de8
child 7823 4ab3a5ee041d
The _SC_PHYS_PAGES method of calculating RAM works on Linux.
src/cpuinfo/SDL_cpuinfo.c
--- a/src/cpuinfo/SDL_cpuinfo.c	Thu Oct 17 11:32:56 2013 -0700
+++ b/src/cpuinfo/SDL_cpuinfo.c	Thu Oct 17 11:32:14 2013 -0700
@@ -637,25 +637,6 @@
             }
         }
 #endif
-#if 0 //def __LINUX__
-        FILE *fpMemInfo = fopen("/proc/meminfo", "r");
-        if (fpMemInfo) {
-            char line[1024];
-            const char *search = "MemTotal:";
-            const size_t searchlen = SDL_strlen(search);
-            while (fgets(line, sizeof(line), fpMemInfo)) {
-                if (SDL_strncasecmp(search, line, searchlen) == 0) {
-                    char *val = line+searchlen;
-                    while (SDL_isspace(*val)) {
-                        ++val;
-                    }
-                    SDL_SystemRAM = SDL_atoi(val) / 1024; /* convert from kB to MB */
-                    break;
-                }
-            }
-            fclose(fpMemInfo);
-        }
-#endif
     }
     return SDL_SystemRAM;
 }