Changeset: d6f89e2b019d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d6f89e2b019d
Modified Files:
        MonetDB/src/gdk/gdk_system.mx
Branch: Jun2010
Log Message:

Merged heads.


diffs (35 lines):

diff -r 6af87f2fd50f -r d6f89e2b019d MonetDB/src/gdk/gdk_system.mx
--- a/MonetDB/src/gdk/gdk_system.mx     Wed Jun 30 13:22:59 2010 +0200
+++ b/MonetDB/src/gdk/gdk_system.mx     Wed Jun 30 13:44:36 2010 +0200
@@ -372,20 +372,22 @@
 #  if defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES)
        _MT_npages = sysconf(_SC_PHYS_PAGES);
 #  else
-#   if defined(HAVE_SYS_SYSCTL_H) && defined(HW_MEMSIZE)
+#   if defined(HAVE_GETRLIMIT) && defined(RLIMIT_RSS)
        {
-               int mib[2] = { CTL_HW, HW_MEMSIZE };
-               unsigned int namelen = sizeof(mib) / sizeof(mib[0]);
-               uint64_t size;
-               size_t len = sizeof(size);
+               struct rlimit rl;
 
-               if (sysctl(mib, namelen, &size, &len, NULL, 0) >= 0) {
-                       _MT_npages = size / _MT_pagesize;
-               }
+               /* Specifies the limit (in pages) of the process's resident set
+                * (the number of virtual pages resident in RAM). This limit
+                * only has effect in Linux 2.4.x, x < 30, and there only
+                * affects calls to madvise() specifying MADV_WILLNEED */
+               /* FIXME: this looks like a total wrong thing to check in any
+                * case to me */
+               getrlimit(RLIMIT_RSS, &rl);
+               _MT_npages = rl.rlim_cur / _MT_pagesize;
        }
 #   else
 #    error "don't know how to get the amount of physical memory for your OS"
-#   endif /* sysctl */
+#   endif /* getrlimit */
 #  endif /* sysconf */
 # endif        /* GlobalMemoryStatus */
 #endif /* GlobalMemoryStatusEx */
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to