From: Christof Schmitt Date: Fri, 9 Jan 2015 23:17:08 +0000 (-0700) Subject: debug: Add lttng backend X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=1257977125b545ebd0d991e17ffa6afc50c2d907;p=obnox%2Fsamba%2Fsamba-obnox.git debug: Add lttng backend Signed-off-by: Christof Schmitt Reviewed-by: Amitay Isaacs --- diff --git a/docs-xml/smbdotconf/logging/logging.xml b/docs-xml/smbdotconf/logging/logging.xml index 039a9656e88..20842bd9710 100644 --- a/docs-xml/smbdotconf/logging/logging.xml +++ b/docs-xml/smbdotconf/logging/logging.xml @@ -30,6 +30,7 @@ syslog file systemd + lttng diff --git a/lib/util/debug.c b/lib/util/debug.c index 81acbb1b33d..c2781afa390 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -186,6 +186,15 @@ static void debug_systemd_log(int msg_level, } #endif +#ifdef HAVE_LTTNG_TRACEF +#include +static void debug_lttng_log(int msg_level, + const char *msg, const char *msg_no_nl) +{ + tracef(msg_no_nl); +} +#endif /* WITH_LTTNG_TRACEF */ + static struct debug_backend { const char *name; int log_level; @@ -211,6 +220,14 @@ static struct debug_backend { .log = debug_systemd_log, }, #endif + +#ifdef HAVE_LTTNG_TRACEF + { + .name = "lttng", + .log = debug_lttng_log, + }, +#endif + }; static struct debug_backend *debug_find_backend(const char *name) diff --git a/lib/util/wscript b/lib/util/wscript index 23716890317..26b5564babc 100644 --- a/lib/util/wscript +++ b/lib/util/wscript @@ -9,3 +9,11 @@ def set_options(opt): opt.add_option('--without-systemd', help=("Disable systemd integration"), action='store_false', dest='enable_systemd') + + opt.add_option('--with-lttng', + help=("Enable lttng integration"), + action='store_true', dest='enable_lttng') + + opt.add_option('--without-lttng', + help=("Disable lttng integration"), + action='store_false', dest='enable_lttng') diff --git a/lib/util/wscript_build b/lib/util/wscript_build index 5f89c83a20b..182f80af35e 100755 --- a/lib/util/wscript_build +++ b/lib/util/wscript_build @@ -31,7 +31,7 @@ bld.SAMBA_SUBSYSTEM('close-low-fd', bld.SAMBA_LIBRARY('samba-debug', source='debug.c', deps='replace time-basic close-low-fd talloc socket-blocking', - public_deps='systemd-journal', + public_deps='systemd-journal lttng-ust', local_include=False, private_library=True) diff --git a/lib/util/wscript_configure b/lib/util/wscript_configure index 0153fb8f67f..84c3414334b 100644 --- a/lib/util/wscript_configure +++ b/lib/util/wscript_configure @@ -127,3 +127,17 @@ if (conf.CONFIG_SET('HAVE_SYSTEMD_SD_JOURNAL_H') and else: conf.SET_TARGET_TYPE('systemd-journal', 'EMPTY') conf.undefine('HAVE_SYSTEMD_JOURNAL') + +if Options.options.enable_lttng != False: + conf.check_cfg(package='lttng-ust', args='--cflags --libs', + msg='Checking for lttng-ust', uselib_store="LTTNG-UST") + conf.CHECK_HEADERS('lttng/tracef.h', lib='lttng-st') + conf.CHECK_LIB('lttng-ust', shlib=True) + +if (conf.CONFIG_SET('HAVE_LTTNG_TRACEF_H') and + conf.CONFIG_SET('HAVE_LTTNG_UST')): + conf.DEFINE('HAVE_LTTNG_TRACEF', '1') + conf.env['HAVE_LTTNG_TRACEF'] = True +else: + conf.SET_TARGET_TYPE('lttng-ust', 'EMPTY') + conf.undefine('HAVE_LTTNG_TRACEF')