lttng-ust(3): document `lttng_ust_loaded` symbol
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 29 Nov 2016 17:10:57 +0000 (12:10 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 29 Nov 2016 21:03:50 +0000 (16:03 -0500)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
doc/man/lttng-ust.3.txt

index 0593406a857a1ccf68cce4875239faa2c7fb3c25..61132a6871c02d65258b226aa942d8867911a0ba 100644 (file)
@@ -991,6 +991,33 @@ Fields:
 |===
 
 
+Detect if LTTng-UST is loaded
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+To detect if `liblttng-ust` is loaded from an application:
+
+. Define the `lttng_ust_loaded` weak symbol globally:
++
+------------------------------------------------------------------------
+int lttng_ust_loaded __attribute__((weak));
+------------------------------------------------------------------------
++
+This weak symbol is set by the constructor of `liblttng-ust`.
+
+. Test `lttng_ust_loaded` where needed:
++
+------------------------------------------------------------------------
+/* ... */
+
+if (lttng_ust_loaded) {
+    /* LTTng-UST is loaded */
+} else {
+    /* LTTng-UST is NOT loaded */
+}
+
+/* ... */
+------------------------------------------------------------------------
+
+
 [[example]]
 EXAMPLE
 -------
This page took 0.024971 seconds and 4 git commands to generate.