From: Philippe Proulx Date: Tue, 29 Nov 2016 17:10:57 +0000 (-0500) Subject: lttng-ust(3): document `lttng_ust_loaded` symbol X-Git-Tag: v2.10.0-rc1~23 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2c520d0e6e7ae99491b830f55cb663d030c9a22e;p=lttng-ust.git lttng-ust(3): document `lttng_ust_loaded` symbol Signed-off-by: Philippe Proulx Signed-off-by: Mathieu Desnoyers --- diff --git a/doc/man/lttng-ust.3.txt b/doc/man/lttng-ust.3.txt index 0593406a..61132a68 100644 --- a/doc/man/lttng-ust.3.txt +++ b/doc/man/lttng-ust.3.txt @@ -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 -------