[ohm] ohm: Branch 'master' - 5 commits
Rob Taylor
robtaylor at kemper.freedesktop.org
Fri Aug 3 07:30:57 PDT 2007
ohmd/ohm-main.c | 32 ++++++++++++++++++++++++++++++--
ohmd/ohm-module.c | 2 +-
ohmd/ohm-plugin.c | 1 -
ohmd/run-ohm.sh | 29 +++++++++++++++++++++++++----
4 files changed, 56 insertions(+), 8 deletions(-)
New commits:
diff-tree 774e77bfcc06218ce423cb16bdd9b9e3fe11cc7b (from 58005d431f6abac330c6682143c160996071c597)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date: Fri Aug 3 15:33:22 2007 +0100
fix crasher in ohmd/ohm-plugin.c
ohm_plugin_free_hal_table was removing items from hal_udis as it iterated them. That's bad, mmkay?
diff --git a/ohmd/ohm-plugin.c b/ohmd/ohm-plugin.c
index 5279df3..9edf003 100644
--- a/ohmd/ohm-plugin.c
+++ b/ohmd/ohm-plugin.c
@@ -404,7 +404,6 @@ ohm_plugin_free_hal_table (OhmPlugin *pl
libhal_device_remove_property_watch (plugin->priv->hal_ctx, temp_udi, NULL);
}
g_free (temp_udi);
- g_ptr_array_remove (plugin->priv->hal_udis, temp_udi);
}
}
diff-tree 58005d431f6abac330c6682143c160996071c597 (from 464338980e1acf745f76ab737951fa67a39d4e17)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date: Fri Aug 3 15:32:09 2007 +0100
fix memleak in OhmModule
Fixes a memleak in ohm_module_read_defaults, where module->priv->mod_require
was still being filled with strdups of the requires. (a3d42549 changed the
logic so the results of g_key_file_get_string_list were kept around until the
mod_* lists were empty).
diff --git a/ohmd/ohm-module.c b/ohmd/ohm-module.c
index c518d47..9e04f82 100644
--- a/ohmd/ohm-module.c
+++ b/ohmd/ohm-module.c
@@ -361,7 +361,7 @@ ohm_module_read_defaults (OhmModule *mod
}
for (i=0; i<length; i++) {
ohm_debug ("ModulesRequired: %s", module->priv->modules_required[i]);
- module->priv->mod_require = g_slist_prepend (module->priv->mod_require, (gpointer) strdup(module->priv->modules_required[i]));
+ module->priv->mod_require = g_slist_prepend (module->priv->mod_require, (gpointer) module->priv->modules_required[i]);
}
g_key_file_free (keyfile);
diff-tree 464338980e1acf745f76ab737951fa67a39d4e17 (from 79de50a2d1666be3f63243b2b91c738f99c3271a)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date: Fri Aug 3 15:29:03 2007 +0100
add command line options for --g-fatal-warnings and --g-fatal-critical
Gives ohmd two new command line options: --g-fatal-warnings that makes g_warnings fatal and exits, and --g-fatal-critical, which makes g_critical cause a fatal error.
Updates run-ohm.sh to always run with --g-fatal-critical
diff --git a/ohmd/ohm-main.c b/ohmd/ohm-main.c
index 2a0d01d..c166008 100644
--- a/ohmd/ohm-main.c
+++ b/ohmd/ohm-main.c
@@ -111,6 +111,8 @@ main (int argc, char *argv[])
gboolean verbose = FALSE;
gboolean no_daemon = FALSE;
gboolean timed_exit = FALSE;
+ gboolean g_fatal_warnings = FALSE;
+ gboolean g_fatal_critical = FALSE;
OhmManager *manager = NULL;
GError *error = NULL;
GOptionContext *context;
@@ -122,6 +124,10 @@ main (int argc, char *argv[])
N_("Show extra debugging information"), NULL },
{ "timed-exit", '\0', 0, G_OPTION_ARG_NONE, &timed_exit,
N_("Exit after a small delay (for debugging)"), NULL },
+ { "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &g_fatal_warnings,
+ N_("Make all warnings fatal"), NULL },
+ { "g-fatal-critical", 0, 0, G_OPTION_ARG_NONE, &g_fatal_critical,
+ N_("Make all critical warnings fatal"), NULL },
{ NULL}
};
@@ -131,6 +137,16 @@ main (int argc, char *argv[])
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
+ if (g_fatal_warnings || g_fatal_critical)
+ {
+ GLogLevelFlags fatal_mask;
+
+ g_debug("setting fatal warnings");
+ fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
+ fatal_mask |= (g_fatal_warnings?G_LOG_LEVEL_WARNING:0) | G_LOG_LEVEL_CRITICAL;
+ g_log_set_always_fatal (fatal_mask);
+ }
+
g_type_init ();
if (!g_thread_supported ())
g_thread_init (NULL);
diff --git a/ohmd/run-ohm.sh b/ohmd/run-ohm.sh
index 2825752..f36b33b 100755
--- a/ohmd/run-ohm.sh
+++ b/ohmd/run-ohm.sh
@@ -39,5 +39,5 @@ fi
export OHM_CONF_DIR=$OHM_TMPDIR/etc/ohm
export OHM_PLUGIN_DIR=$OHM_TMPDIR/lib/ohm
-echo "Execing: $prefix ./ohmd --no-daemon --verbose $@"
-sudo $prefix ./ohmd --no-daemon --verbose $@
+echo "Execing: $prefix ./ohmd --no-daemon --verbose --g-fatal-critical $@"
+sudo $prefix ./ohmd --no-daemon --verbose --g-fatal-critical $@
diff-tree 79de50a2d1666be3f63243b2b91c738f99c3271a (from 87c1a4c36f0a2f08b66101f335ea9cecfd77fafa)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date: Fri Aug 3 14:52:03 2007 +0100
add SIGINT handler to ohmd
Add a SIGINT handler that quits the mainloop. Good for testing exiting..
diff --git a/ohmd/ohm-main.c b/ohmd/ohm-main.c
index 2842f97..2a0d01d 100644
--- a/ohmd/ohm-main.c
+++ b/ohmd/ohm-main.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <unistd.h>
+#include <signal.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <dbus/dbus-glib.h>
@@ -34,6 +35,8 @@
#include "ohm-manager.h"
#include "ohm-dbus-manager.h"
+static GMainLoop *loop;
+
/**
* ohm_object_register:
* @connection: What we want to register to
@@ -89,13 +92,21 @@ ohm_object_register (DBusGConnection *co
return TRUE;
}
+
+void sighandler(int signum)
+{
+ if (signum == SIGINT) {
+ g_debug ("Caught SIGINT, exiting");
+ g_main_loop_quit (loop);
+ }
+}
+
/**
* main:
**/
int
main (int argc, char *argv[])
{
- GMainLoop *loop;
DBusGConnection *connection;
gboolean verbose = FALSE;
gboolean no_daemon = FALSE;
@@ -149,6 +160,8 @@ main (int argc, char *argv[])
return 0;
}
+ signal (SIGINT, sighandler);
+
ohm_debug ("Idle");
loop = g_main_loop_new (NULL, FALSE);
@@ -158,7 +171,6 @@ main (int argc, char *argv[])
g_main_loop_run (loop);
}
- g_main_loop_quit (loop);
g_object_unref (manager);
dbus_g_connection_unref (connection);
g_option_context_free (context);
diff-tree 87c1a4c36f0a2f08b66101f335ea9cecfd77fafa (from f7df59e20dd812d0dcb9cdd9d8a5feddab5f9257)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date: Fri Aug 3 14:50:45 2007 +0100
make run-ohm.sh more capable
Adds options --memcheck and --massif for running ohmd with the corresponding
valgrid tools. Also adds a --help option.
diff --git a/ohmd/run-ohm.sh b/ohmd/run-ohm.sh
index 86e5ad7..2825752 100755
--- a/ohmd/run-ohm.sh
+++ b/ohmd/run-ohm.sh
@@ -2,6 +2,22 @@
OHM_TMPDIR=/tmp/run-ohmd-$USER
+if [ "$1" = "--help" ]; then
+ echo "Usage:"
+ echo " $0 [run-options] [ohm-options]"
+ echo
+ echo "Run Options:"
+ echo " --skip-plugin-install: Don't do a temporary install of the plugins."
+ echo " Only use this if $0 has already been run"
+ echo " without this option"
+ echo " --debug: Run with gdb"
+ echo " --memcheck: Run with valgrind memcheck tool"
+ echo " --massif: Run with valgrind massif heap-profiling tool"
+ echo
+ ./ohmd --help
+ exit 0
+fi
+
if [ "$1" = "--skip-plugin-install" ] ; then
shift
else
@@ -11,12 +27,17 @@ fi
if [ "$1" = "--debug" ] ; then
shift
- commandline="sudo gdb --args ./ohmd --no-daemon --verbose $@"
-else
- commandline="sudo ./ohmd --no-daemon --verbose $@"
+ prefix="gdb --args"
+elif [ "$1" = "--memcheck" ] ; then
+ shift
+ prefix="valgrind --show-reachable=yes --leak-check=full --tool=memcheck"
+elif [ "$1" = "--massif" ] ; then
+ shift
+ prefix="valgrind --tool=massif"
fi
export OHM_CONF_DIR=$OHM_TMPDIR/etc/ohm
export OHM_PLUGIN_DIR=$OHM_TMPDIR/lib/ohm
-$commandline
+echo "Execing: $prefix ./ohmd --no-daemon --verbose $@"
+sudo $prefix ./ohmd --no-daemon --verbose $@
More information about the Ohm-devel
mailing list