X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ust-common%2Fust-common.c;h=1aee7ac7a7a99f4b47ce557ea68c9ab09eb80481;hb=f73bcf5eafdc10b2bbb32de0bcef709de0f8f5e5;hp=cefff67a82d721d0c63c6940e86563ed9cf53c38;hpb=39313bf35301f186b2517e05e0bda38e138e868c;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 cefff67a..1aee7ac7 100644 --- a/src/lib/lttng-ust-common/ust-common.c +++ b/src/lib/lttng-ust-common/ust-common.c @@ -4,18 +4,41 @@ * 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" +#include "lib/lttng-ust-common/getcpu.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 the fd-tracker, other libraries using it should also call - * this in their constructor in case it gets executed before this one. + * Initialize the shared state of the fd tracker. + */ + lttng_ust_fd_tracker_init(); + + /* + * Initialize the potential user-provided clock plugin. */ - lttng_ust_init_fd_tracker(); + lttng_ust_clock_init(); + + /* + * Initialize the potential user-provided getcpu plugin. + */ + lttng_ust_getcpu_plugin_init(); +} + +void lttng_ust_common_alloc_tls(void) +{ + lttng_ust_fd_tracker_alloc_tls(); }