diff options
author | Agney Lopes Roth Ferraz <agney@debian.org> | 2009-03-28 22:55:02 -0300 |
---|---|---|
committer | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:48 -0500 |
commit | 1b6665085f47e0a86e4bebd5e313a2ab63600eb4 (patch) | |
tree | 6b7dedc1886b42d07cc48359470fe3f595500cc8 /arch/linux/common/modules.h | |
parent | 819c0c3382b06fc0f0a1679465966f811aa2e0f8 (diff) | |
parent | 4979bb6cbbbe39eb44c32530cd13f86bf44e5d77 (diff) |
Import Debian changes 0.5c-1
hardinfo (0.5c-1) unstable; urgency=low
* New upstream version.
(Closes: #517591, #511237, #457703, #519256, #449250, #457820, #497758)
Diffstat (limited to 'arch/linux/common/modules.h')
-rw-r--r-- | arch/linux/common/modules.h | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/arch/linux/common/modules.h b/arch/linux/common/modules.h index 6fbe13bd..7ea238b7 100644 --- a/arch/linux/common/modules.h +++ b/arch/linux/common/modules.h @@ -1,6 +1,6 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> + * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,11 +29,18 @@ remove_module_devices(gpointer key, gpointer value, gpointer data) return g_str_has_prefix(key, "MOD"); } +static GHashTable *_module_hash_table = NULL; + static void scan_modules_do(void) { FILE *lsmod; gchar buffer[1024]; + gchar *lsmod_path; + + if (!_module_hash_table) { + _module_hash_table = g_hash_table_new(g_str_hash, g_str_equal); + } if (module_list) { g_free(module_list); @@ -42,9 +49,12 @@ scan_modules_do(void) module_list = NULL; g_hash_table_foreach_remove(moreinfo, remove_module_devices, NULL); - lsmod = popen("/sbin/lsmod", "r"); - if (!lsmod) + lsmod_path = find_program("lsmod"); + lsmod = popen(lsmod_path, "r"); + if (!lsmod) { + g_free(lsmod_path); return; + } fgets(buffer, 1024, lsmod); /* Discards the first line */ @@ -95,7 +105,15 @@ scan_modules_do(void) if (description && g_str_equal(description, "<none>")) { g_free(description); description = g_strdup(""); - } + + g_hash_table_insert(_module_hash_table, + g_strdup(modname), + g_strdup_printf("Kernel module (%s)", modname)); + } else { + g_hash_table_insert(_module_hash_table, + g_strdup(modname), + g_strdup(description)); + } /* append this module to the list of modules */ module_list = h_strdup_cprintf("$%s$%s=%s\n", @@ -119,7 +137,7 @@ scan_modules_do(void) "License=%s\n", NONE_IF_NULL(filename), memory / 1024.0, - NONE_IF_NULL(modname), + modname, NONE_IF_NULL(description), NONE_IF_NULL(vermagic), NONE_IF_NULL(author), @@ -146,4 +164,6 @@ scan_modules_do(void) g_free(filename); } pclose(lsmod); + + g_free(lsmod_path); } |