diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-01-21 22:11:58 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-01-21 22:11:58 +0100 |
commit | 346c30414e8a347aa001758d666124aec4035cd9 (patch) | |
tree | 45cba40b8ff7a56e69b60e0900709719327eb6e8 /src | |
parent | 8074bba2f209e26bc2ab6cf0426241f5ec30da23 (diff) | |
download | connman-346c30414e8a347aa001758d666124aec4035cd9.tar.gz connman-346c30414e8a347aa001758d666124aec4035cd9.tar.bz2 connman-346c30414e8a347aa001758d666124aec4035cd9.zip |
Add support for toggling debug output
Diffstat (limited to 'src')
-rw-r--r-- | src/connman.h | 1 | ||||
-rw-r--r-- | src/log.c | 8 | ||||
-rw-r--r-- | src/main.c | 8 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/connman.h b/src/connman.h index 42382348..729dc42d 100644 --- a/src/connman.h +++ b/src/connman.h @@ -58,6 +58,7 @@ void __connman_profile_list(DBusMessageIter *iter); int __connman_log_init(gboolean detach, gboolean debug); void __connman_log_cleanup(void); +void __connman_toggle_debug(void); gboolean __connman_debug_enabled(void); #include <connman/plugin.h> @@ -90,6 +90,14 @@ void connman_debug(const char *format, ...) va_end(ap); } +void __connman_toggle_debug(void) +{ + if (debug_enabled == TRUE) + debug_enabled = FALSE; + else + debug_enabled = TRUE; +} + int __connman_log_init(gboolean detach, gboolean debug) { int option = LOG_NDELAY | LOG_PID; @@ -43,6 +43,11 @@ static void sig_term(int sig) g_main_loop_quit(main_loop); } +static void sig_debug(int sig) +{ + __connman_toggle_debug(); +} + static void disconnect_callback(DBusConnection *conn, void *user_data) { DBG("D-Bus disconnect"); @@ -194,6 +199,9 @@ int main(int argc, char *argv[]) sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); + sa.sa_handler = sig_debug; + sigaction(SIGUSR2, &sa, NULL); + g_main_loop_run(main_loop); __connman_element_stop(); |