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.9.0~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=273554e4e1c9747afc2b0911fd0d124708720cea;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 65fb4d35..9fd3e8b8 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 -------