X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ust-common%2Fust-common.c;h=e6c81ba65445b24d2d6510d6779a0e4abbd9e28f;hb=f41a6b5f307db311352f79d35f0656959db60891;hp=036c1e288af9ee09ef6510bab12f6a86a145719f;hpb=793dd3d99daee051358de2b751472dcd29c11a2f;p=lttng-ust.git diff --git a/src/lib/lttng-ust-common/ust-common.c b/src/lib/lttng-ust-common/ust-common.c index 036c1e28..e6c81ba6 100644 --- a/src/lib/lttng-ust-common/ust-common.c +++ b/src/lib/lttng-ust-common/ust-common.c @@ -4,21 +4,35 @@ * Copyright (C) 2021 Michael Jeanson */ +#include + #include "common/logging.h" #include "common/ust-fd.h" +#include "common/getenv.h" + +#include "lib/lttng-ust-common/fd-tracker.h" +#include "lib/lttng-ust-common/clock.h" -static -void lttng_ust_common_init(void) - __attribute__((constructor)); -static -void lttng_ust_common_init(void) +/* + * The liblttng-ust-common constructor, initialize the internal shared state. + * Libraries linking on liblttng-ust-common should also call this early in + * their constructor since there is no reliable way to guarantee the execution + * order of constructors across shared library. + */ +void lttng_ust_common_ctor(void) { - /* Initialize logging for liblttng-ust-common */ - lttng_ust_logging_init(); + /* + * Initialize the shared state of the fd tracker. + */ + lttng_ust_fd_tracker_init(); /* - * Initialize the fd-tracker, other libraries using it should also call - * this in their constructor in case it gets executed before this one. + * Initialize the potential user-provided clock plugin. */ - lttng_ust_init_fd_tracker(); + lttng_ust_clock_init(); +} + +void lttng_ust_common_alloc_tls(void) +{ + lttng_ust_fd_tracker_alloc_tls(); }