Expose liblttng-libc-wrapper malloc ctor in public header
[lttng-ust.git] / include / lttng / ust-libc-wrapper.h
diff --git a/include/lttng/ust-libc-wrapper.h b/include/lttng/ust-libc-wrapper.h
new file mode 100644 (file)
index 0000000..685ebfb
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright (C) 2020 Michael Jeanson <mjeanson@efficios.com>
+ *
+ * Public symbols of liblttng-ust-libc-wrapper.so
+ */
+
+#ifndef _LTTNG_UST_LIBC_WRAPPER_H
+#define _LTTNG_UST_LIBC_WRAPPER_H
+
+/*
+ * This is the constructor for the malloc part of the libc wrapper. It is
+ * publicly exposed because the malloc override needs to be initialized before
+ * the process becomes multithreaded and thus must happen before the main
+ * constructor of liblttng-ust starts threads. Since there is no reliable way
+ * to guarantee the execution order of constructors across shared library, the
+ * liblttng-ust constructor has to call the malloc constructor before starting
+ * any thread. This is achieved by having a weak public version of this
+ * function in liblttng-ust that is overridden by the one in
+ * liblttng-ust-wrapper-libc when it's preloaded.
+ */
+void lttng_ust_libc_wrapper_malloc_init(void);
+
+#endif
This page took 0.024102 seconds and 4 git commands to generate.