[tracker/tracker-0.16] libtracker-common: Add /proc/meminfo replacement for Solaris



commit dd254333a51639708254962b32cb9b1e46944d44
Author: Ralph Boehme <sloowfranklin gmail com>
Date:   Fri Jul 5 17:03:18 2013 +0200

    libtracker-common: Add /proc/meminfo replacement for Solaris

 src/libtracker-common/tracker-os-dependant-unix.c |   32 +++++++++++----------
 1 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/src/libtracker-common/tracker-os-dependant-unix.c 
b/src/libtracker-common/tracker-os-dependant-unix.c
index 79eb837..d23eee1 100644
--- a/src/libtracker-common/tracker-os-dependant-unix.c
+++ b/src/libtracker-common/tracker-os-dependant-unix.c
@@ -230,7 +230,22 @@ tracker_create_permission_string (struct stat finfo)
 static glong
 get_memory_total (void)
 {
-#if !defined (__OpenBSD__)
+#if defined (__OpenBSD__)
+       glong total = 0;
+       int64_t physmem;
+       size_t len;
+       static gint mib[] = { CTL_HW, HW_PHYSMEM64 };
+
+       len = sizeof (physmem);
+
+       if (sysctl (mib, G_N_ELEMENTS (mib), &physmem, &len, NULL, 0) == -1) {
+               g_critical ("Couldn't get memory information: %d", errno);
+       } else {
+               total = physmem;
+       }
+#elif defined (__sun)
+    glong total = (glong)sysconf(_SC_PAGESIZE) * (glong)sysconf(_SC_PHYS_PAGES);
+#else
        GError      *error = NULL;
        const gchar *filename;
        gchar       *contents = NULL;
@@ -264,20 +279,7 @@ get_memory_total (void)
                }
                g_free (contents);
        }
-#else /* OpenBSD */
-       glong total = 0;
-       int64_t physmem;
-       size_t len;
-       static gint mib[] = { CTL_HW, HW_PHYSMEM64 };
-
-       len = sizeof (physmem);
-
-       if (sysctl (mib, G_N_ELEMENTS (mib), &physmem, &len, NULL, 0) == -1) {
-               g_critical ("Couldn't get memory information: %d", errno);
-       } else {
-               total = physmem;
-       }
-#endif /* !OpenBSD */
+#endif
 
        return total;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]