X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-ust-comm.c;h=a5a2cc2b689ab9331da4ff2de3575bf8edd901bc;hb=74f98bc94c69b76acfe4db62fbf78787a10bef75;hp=6105403a25d032b618df9c6202644ff138a0a034;hpb=01f0e40ce5b0c30c7c0706b63532049b311c83cf;p=lttng-ust.git diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index 6105403a..a5a2cc2b 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -106,6 +106,14 @@ static pthread_mutex_t ust_fork_mutex = PTHREAD_MUTEX_INITIALIZER; /* Should the ust comm thread quit ? */ static int lttng_ust_comm_should_quit; +/* + * This variable can be tested by applications to check whether + * lttng-ust is loaded. They simply have to define their own + * "lttng_ust_loaded" weak symbol, and test it. It is set to 1 by the + * library constructor. + */ +int lttng_ust_loaded __attribute__((weak)); + /* * Return 0 on success, -1 if should quit. * The lock is taken in both cases. @@ -1574,6 +1582,8 @@ void __attribute__((constructor)) lttng_ust_init(void) lttng_fixup_procname_tls(); lttng_fixup_ust_mutex_nest_tls(); + lttng_ust_loaded = 1; + /* * We want precise control over the order in which we construct * our sub-libraries vs starting to receive commands from @@ -1705,6 +1715,7 @@ void lttng_ust_cleanup(int exiting) { cleanup_sock_info(&global_apps, exiting); cleanup_sock_info(&local_apps, exiting); + local_apps.allowed = 0; /* * The teardown in this function all affect data structures * accessed under the UST lock by the listener thread. This