diff options
| author | Michael Biebl <biebl@debian.org> | 2013-02-09 03:16:54 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2013-02-09 03:16:54 +0100 |
| commit | e17c5736fc3722ce51cb33f3edb203960125a4c1 (patch) | |
| tree | 2b41ee92b307915e9d97f0ef2c012fc793653599 /src/logging/nm-logging.c | |
| parent | 9c202e3e860b3be9e1f8882630b69affbb130102 (diff) | |
Imported Upstream version 0.9.7.997 upstream/0.9.7.997
Diffstat (limited to 'src/logging/nm-logging.c')
| -rw-r--r-- | src/logging/nm-logging.c | 99 |
1 files changed, 10 insertions, 89 deletions
diff --git a/src/logging/nm-logging.c b/src/logging/nm-logging.c index 3461412e..8c663828 100644 --- a/src/logging/nm-logging.c +++ b/src/logging/nm-logging.c @@ -32,22 +32,18 @@ #include <strings.h> #include <string.h> -#ifdef ENABLE_CRASHTRACE -#include <execinfo.h> -#endif - #include <glib/gi18n.h> #include "nm-logging.h" #define LOGD_ALL \ - (LOGD_HW | LOGD_RFKILL | LOGD_ETHER | LOGD_WIFI | LOGD_BT | LOGD_MB | \ + (LOGD_PLATFORM | LOGD_RFKILL | LOGD_ETHER | LOGD_WIFI | LOGD_BT | LOGD_MB | \ LOGD_DHCP4 | LOGD_DHCP6 | LOGD_PPP | LOGD_WIFI_SCAN | LOGD_IP4 | \ LOGD_IP6 | LOGD_AUTOIP4 | LOGD_DNS | LOGD_VPN | LOGD_SHARING | \ LOGD_SUPPLICANT | LOGD_AGENTS | LOGD_SETTINGS | LOGD_SUSPEND | \ LOGD_CORE | LOGD_DEVICE | LOGD_OLPC_MESH | LOGD_WIMAX | \ LOGD_INFINIBAND | LOGD_FIREWALL | LOGD_ADSL | LOGD_BOND | \ - LOGD_VLAN) + LOGD_VLAN | LOGD_BRIDGE) #define LOGD_DEFAULT (LOGD_ALL & ~LOGD_WIFI_SCAN) @@ -69,7 +65,7 @@ static const LogDesc level_descs[] = { static const LogDesc domain_descs[] = { { LOGD_NONE, "NONE" }, - { LOGD_HW, "HW" }, + { LOGD_PLATFORM, "PLATFORM" }, { LOGD_RFKILL, "RFKILL" }, { LOGD_ETHER, "ETHER" }, { LOGD_WIFI, "WIFI" }, @@ -98,6 +94,7 @@ static const LogDesc domain_descs[] = { { LOGD_ADSL, "ADSL" }, { LOGD_BOND, "BOND" }, { LOGD_VLAN, "VLAN" }, + { LOGD_BRIDGE, "BRIDGE" }, { 0, NULL } }; @@ -180,6 +177,12 @@ nm_logging_setup (const char *level, const char *domains, GError **error) found = TRUE; } + /* Check for compatibility domains */ + if (!strcasecmp (*iter, "HW")) { + new_domains |= LOGD_PLATFORM; + found = TRUE; + } + if (!found) { g_set_error (error, NM_LOGGING_ERROR, NM_LOGGING_ERROR_UNKNOWN_DOMAIN, _("Unknown log domain '%s'"), *iter); @@ -271,88 +274,6 @@ _nm_log (const char *loc, /************************************************************************/ static void -fallback_get_backtrace (void) -{ -#ifdef ENABLE_CRASHTRACE - void *frames[64]; - Dl_info info; - size_t size; - guint32 i; - const char *name; - - size = backtrace (frames, G_N_ELEMENTS (frames)); - - syslog (LOG_CRIT, "******************* START **********************************"); - for (i = 0; i < size; i++) { - dladdr (frames[i], &info); - name = (info.dli_fname && *info.dli_fname) ? info.dli_fname : "(vdso)"; - if (info.dli_saddr) { - syslog (LOG_CRIT, "Frame %d: %s (%s+0x%lx) [%p]", - i, name, - info.dli_sname, - (gulong)((guchar *)frames[i] - (guchar *)info.dli_saddr), - frames[i]); - } else { - syslog (LOG_CRIT, "Frame %d: %s (%p+0x%lx) [%p]", - i, name, - info.dli_fbase, - (gulong)((guchar *)frames[i] - (guchar *)info.dli_saddr), - frames[i]); - } - } - syslog (LOG_CRIT, "******************* END **********************************"); -#endif /* ENABLE_CRASHTRACE */ -} - - -static gboolean -crashlogger_get_backtrace (void) -{ - gboolean success = FALSE; - int pid; - - pid = fork(); - if (pid > 0) - { - /* Wait for the child to finish */ - int estatus; - if (waitpid (pid, &estatus, 0) != -1) - { - /* Only succeed if the crashlogger succeeded */ - if (WIFEXITED (estatus) && (WEXITSTATUS (estatus) == 0)) - success = TRUE; - } - } - else if (pid == 0) - { - /* Child process */ - execl (LIBEXECDIR"/nm-crash-logger", - LIBEXECDIR"/nm-crash-logger", NULL); - } - - return success; -} - - -void -nm_logging_backtrace (void) -{ - struct stat s; - gboolean fallback = TRUE; - - /* Try to use gdb via nm-crash-logger if it exists, since - * we get much better information out of it. Otherwise - * fall back to execinfo. - */ - if (stat (LIBEXECDIR"/nm-crash-logger", &s) == 0) - fallback = crashlogger_get_backtrace () ? FALSE : TRUE; - - if (fallback) - fallback_get_backtrace (); -} - - -static void nm_log_handler (const gchar *log_domain, GLogLevelFlags level, const gchar *message, |