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:06:58 +0000 (16:06 -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 65fb4d351bc980dc2dbf2c2f9c8bde144048dcdf..9fd3e8b8035f2a728e700007f03e475a06547f0d 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.026858 seconds and 4 git commands to generate.