]> git.saurik.com Git - wxWidgets.git/commitdiff
implemented wxGetFreeMemory() under IRIX (patch 1360356); made wxMemorySize always...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 25 Nov 2005 22:09:22 +0000 (22:09 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 25 Nov 2005 22:09:22 +0000 (22:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36250 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/utils.h
src/unix/utilsunx.cpp

index ed432b85826b83d4825b2dea8b0c0ec93b709707..03e24056b0d6b7560d24864c64f1ba7ba11d7c38 100644 (file)
@@ -52,16 +52,13 @@ class WXDLLIMPEXP_CORE wxPoint;
 #define wxMax(a,b)            (((a) > (b)) ? (a) : (b))
 #define wxMin(a,b)            (((a) < (b)) ? (a) : (b))
 
-// wxGetFreeMemory can return huge amount of memory on 64-bit platforms
-// define wxMemorySize according to the type which best fits your platform
-#if wxUSE_LONGLONG && defined(__WIN64__)
-    // 64 bit Windowses have sizeof(long) only 32 bit long
-    // we need to use wxLongLong to express memory sizes
-    #define wxMemorySize wxLongLong
+// wxGetFreeMemory can return huge amount of memory on 32-bit platforms as well
+// so to always use long long for its result type on all platforms which
+// support it
+#if wxUSE_LONGLONG
+    typedef wxLongLong wxMemorySize;
 #else
-    // 64 bit UNIX has sizeof(long) = 64
-    // assume 32 bit platforms cannnot return more than 32bits of
-    #define wxMemorySize long
+    typedef long wxMemorySize;
 #endif
 
 // ----------------------------------------------------------------------------
index e8e31e528679bd05a8845ee14cafd845e1ce85b1..54354d378dcfe5956af701a9f0e4757c94cbf08d 100644 (file)
     #include <sys/utsname.h> // for uname()
 #endif // HAVE_UNAME
 
+// Used by wxGetFreeMemory().
+#ifdef __SGI__
+    #include <sys/sysmp.h>
+    #include <sys/sysinfo.h>   // for SAGET and MINFO structures
+#endif
+
 // ----------------------------------------------------------------------------
 // conditional compilation
 // ----------------------------------------------------------------------------
@@ -910,6 +916,10 @@ wxMemorySize wxGetFreeMemory()
     }
 #elif defined(__SUN__) && defined(_SC_AVPHYS_PAGES)
     return (wxMemorySize)(sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PAGESIZE));
+#elif defined(__SGI__)
+    struct rminfo realmem;
+    if ( sysmp(MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0 )
+        return ((wxMemorySize)realmem.physmem * sysconf(_SC_PAGESIZE));
 //#elif defined(__FREEBSD__) -- might use sysctl() to find it out, probably
 #endif