debug: Add lttng backend
authorChristof Schmitt <cs@samba.org>
Fri, 9 Jan 2015 23:17:08 +0000 (16:17 -0700)
committerChristof Schmitt <cs@samba.org>
Mon, 23 Mar 2015 20:22:12 +0000 (21:22 +0100)
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
docs-xml/smbdotconf/logging/logging.xml
lib/util/debug.c
lib/util/wscript
lib/util/wscript_build
lib/util/wscript_configure

index 039a9656e88af8c09acdbdb8c0204f367d5993ec..20842bd9710aba2699a2c4a1b4cbad993bd15461 100644 (file)
@@ -30,6 +30,7 @@
     <listitem><para><parameter moreinfo="none">syslog</parameter></para></listitem>
     <listitem><para><parameter moreinfo="none">file</parameter></para></listitem>
     <listitem><para><parameter moreinfo="none">systemd</parameter></para></listitem>
+    <listitem><para><parameter moreinfo="none">lttng</parameter></para></listitem>
   </itemizedlist>
 
 </description>
index 81acbb1b33d99c8dec7f2abc774d43c9e829db06..c2781afa39069f6edb483df2937f6b256531d504 100644 (file)
@@ -186,6 +186,15 @@ static void debug_systemd_log(int msg_level,
 }
 #endif
 
+#ifdef HAVE_LTTNG_TRACEF
+#include <lttng/tracef.h>
+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)
index 23716890317ed574461102db458f543e02608061..26b5564babc19d1ca3609f5d2be4976ea59db260 100644 (file)
@@ -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')
index 5f89c83a20bfbb355617b50299ab68e0bdbf2edc..182f80af35e6ba1e126bd3deb3d2483aee74f2ba 100755 (executable)
@@ -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)
 
index 0153fb8f67f5de17c8fccb71b549c246eedf6dbe..84c3414334b06b98810dd64bf8e95ab6eb14b0a1 100644 (file)
@@ -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')