diff options
Diffstat (limited to 'hardinfo2')
| -rw-r--r-- | hardinfo2/arch/linux/common/devmemory.h | 9 | ||||
| -rw-r--r-- | hardinfo2/computer.c | 18 | ||||
| -rw-r--r-- | hardinfo2/devices.c | 9 | ||||
| -rw-r--r-- | hardinfo2/util.c | 18 | 
4 files changed, 46 insertions, 8 deletions
| diff --git a/hardinfo2/arch/linux/common/devmemory.h b/hardinfo2/arch/linux/common/devmemory.h index cc4b1582..6b3353a7 100644 --- a/hardinfo2/arch/linux/common/devmemory.h +++ b/hardinfo2/arch/linux/common/devmemory.h @@ -21,8 +21,15 @@ static GHashTable *memlabels;  static void __scan_memory()  {      gchar **keys, *tmp; +    static gint linux24_offset = -1;      gint i; +    if (linux24_offset == -1) { +        linux24_offset = idle_free(module_call_method("computer::isLinux2.4")) ? +                         3 : 0; +        DEBUG("linux24_offset=%d", linux24_offset); +    } +          g_file_get_contents("/proc/meminfo", &meminfo, NULL, NULL);      keys = g_strsplit(meminfo, "\n", 0); @@ -33,7 +40,7 @@ static void __scan_memory()      meminfo = g_strdup("");      lginterval = g_strdup(""); -    for (i = 0; keys[i]; i++) { +    for (i = linux24_offset; keys[i]; i++) {          gchar **newkeys = g_strsplit(keys[i], ":", 0);          if (!newkeys[0]) { diff --git a/hardinfo2/computer.c b/hardinfo2/computer.c index fe1f594e..a9bd3a93 100644 --- a/hardinfo2/computer.c +++ b/hardinfo2/computer.c @@ -357,6 +357,24 @@ gchar *callback_users()                             "%s\n", human_users, sys_users);  } +gchar *get_is_linux_24(void) +{ +    scan_os(FALSE); +    return strstr(computer->os->kernel, "Linux 2.4") ? "" : NULL; +} + +ShellModuleMethod* +hi_exported_methods(void) +{ +    static ShellModuleMethod m[] = { +      { "isLinux2.4",	get_is_linux_24 }, +      { NULL } +    }; +     +    return m; +} + +  ModuleEntry *  hi_module_get_entries(void)  { diff --git a/hardinfo2/devices.c b/hardinfo2/devices.c index 9f377f46..e196897e 100644 --- a/hardinfo2/devices.c +++ b/hardinfo2/devices.c @@ -397,3 +397,12 @@ hi_module_get_about(void)      return ma;  } + +gchar ** +hi_module_get_dependencies(void) +{ +    static gchar *deps[] = { "computer.so", NULL }; +     +    return deps; +} + diff --git a/hardinfo2/util.c b/hardinfo2/util.c index b51dab5d..dc4d6553 100644 --- a/hardinfo2/util.c +++ b/hardinfo2/util.c @@ -816,20 +816,24 @@ void tree_view_save_image(gchar *filename)  static gboolean __idle_free_do(gpointer ptr)  { -    DEBUG("Freeing mem @ %p: %s", ptr, -          g_utf8_validate((gchar*)ptr, 3, NULL) ? -                          (gchar*)ptr : "[non string data]"); +    if (ptr) { +        DEBUG("Freeing mem @ %p: %s", ptr, +              g_utf8_validate((gchar*)ptr, 3, NULL) ? +                              (gchar*)ptr : "[non string data]"); -    g_free(ptr); +        g_free(ptr); +    }      return FALSE;  }  gpointer idle_free(gpointer ptr)  { -    DEBUG("Will free mem @ %p in 10000ms", ptr); -     -    g_timeout_add(10000, __idle_free_do, ptr); +    if (ptr) { +        DEBUG("Will free mem @ %p in 10000ms", ptr); +         +        g_timeout_add(10000, __idle_free_do, ptr); +    }      return ptr;  } | 
