Officially, building (and dynamically linking) mismatching LTTng-UST
and LTTng-tools versions is unsupported.
At build time, LTTng-tools ensures that both versions match. However, it
remains possible for a user to mistakenly deploy LTTng-tools built
againt liblttng-ust-ctl v2.x and liblttng-ust-ctl.so from a different
LTTng-UST release. Since the soname major version of liblttng-ust-ctl is
not bumped at every release, this would allow LTTng-tools binary to
load.
In practice, this is unlikely to work since new symbols are introduced
at almost every release cycle. However, it isn't guaranteed.
In the case of a recent change -- removing the underscore prefix of
enumeration mappings used by a variant -- we don't change the ABI, but
we rely on the LTTNG_UST_ABI_MAJOR_VERSION to indicate whether or not
the fix is present to change the interpretation of existing fields.
Adding lttng_ust_ctl_get_version() provides an additional safety net
to check, at runtime, that the version of liblttng-ust-ctl.so that
is loaded matches that of LTTng-tools.
Technically, only major and minor versions are necessary. I propose
including the patchlevel version for future-proofing should we want to
work around known bugs in the future.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I14bee30bb5d2109be0c8c015ed845d70df16630b
void lttng_ust_ctl_sigbus_handle(void *addr);
+int lttng_ust_ctl_get_version(uint32_t *major, uint32_t *minor, uint32_t *patchlevel);
+
#ifdef __cplusplus
}
#endif
return counter->ops->counter_clear(counter->counter, dimension_indexes);
}
+int lttng_ust_ctl_get_version(uint32_t *major, uint32_t *minor,
+ uint32_t *patchlevel) {
+ *major = LTTNG_UST_MAJOR_VERSION;
+ *minor = LTTNG_UST_MINOR_VERSION;
+ *patchlevel = LTTNG_UST_PATCHLEVEL_VERSION;
+ return 0;
+}
+
static
void lttng_ust_ctl_ctor(void)
__attribute__((constructor));