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 | |
| parent | 9c202e3e860b3be9e1f8882630b69affbb130102 (diff) | |
Imported Upstream version 0.9.7.997 upstream/0.9.7.997
Diffstat (limited to 'src/logging')
| -rw-r--r-- | src/logging/Makefile.in | 17 | ||||
| -rw-r--r-- | src/logging/nm-logging.c | 99 | ||||
| -rw-r--r-- | src/logging/nm-logging.h | 6 |
3 files changed, 18 insertions, 104 deletions
diff --git a/src/logging/Makefile.in b/src/logging/Makefile.in index 38c994c2..555d414f 100644 --- a/src/logging/Makefile.in +++ b/src/logging/Makefile.in @@ -61,12 +61,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -215,12 +214,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBM = @LIBM@ -LIBNL1_CFLAGS = @LIBNL1_CFLAGS@ -LIBNL1_LIBS = @LIBNL1_LIBS@ -LIBNL2_CFLAGS = @LIBNL2_CFLAGS@ -LIBNL2_LIBS = @LIBNL2_LIBS@ -LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ -LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ LIBNL_LIBS = @LIBNL_LIBS@ LIBOBJS = @LIBOBJS@ 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, diff --git a/src/logging/nm-logging.h b/src/logging/nm-logging.h index b3c583f2..2c6dadb9 100644 --- a/src/logging/nm-logging.h +++ b/src/logging/nm-logging.h @@ -28,7 +28,7 @@ /* Log domains */ enum { LOGD_NONE = 0x00000000, - LOGD_HW = 0x00000001, /* Hardware detection and info */ + LOGD_PLATFORM = 0x00000001, /* Platform services */ LOGD_RFKILL = 0x00000002, LOGD_ETHER = 0x00000004, LOGD_WIFI = 0x00000008, @@ -57,10 +57,12 @@ enum { LOGD_ADSL = 0x04000000, LOGD_BOND = 0x08000000, LOGD_VLAN = 0x10000000, + LOGD_BRIDGE = 0x20000000, }; #define LOGD_DHCP (LOGD_DHCP4 | LOGD_DHCP6) #define LOGD_IP (LOGD_IP4 | LOGD_IP6) +#define LOGD_HW LOGD_PLATFORM /* Log levels */ enum { @@ -107,7 +109,6 @@ gboolean nm_logging_level_enabled (guint32 level); gboolean nm_logging_domain_enabled (guint32 domain); /* Undefine the nm-utils.h logging stuff to ensure errors */ -#undef nm_print_backtrace #undef nm_get_timestamp #undef nm_info #undef nm_info_str @@ -120,7 +121,6 @@ gboolean nm_logging_domain_enabled (guint32 domain); gboolean nm_logging_setup (const char *level, const char *domains, GError **error); void nm_logging_start (gboolean become_daemon); -void nm_logging_backtrace (void); void nm_logging_shutdown (void); #endif /* NM_LOGGING_H */ |