| 1 | // SPDX-FileCopyrightText: 2020 Michael Jeanson <mjeanson@efficios.com> |
| 2 | // |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | |
| 5 | /* |
| 6 | * Public symbols of liblttng-ust-libc-wrapper.so |
| 7 | */ |
| 8 | |
| 9 | #ifndef _LTTNG_UST_LIBC_WRAPPER_H |
| 10 | #define _LTTNG_UST_LIBC_WRAPPER_H |
| 11 | |
| 12 | /* |
| 13 | * This is the constructor for the malloc part of the libc wrapper. It is |
| 14 | * publicly exposed because the malloc override needs to be initialized before |
| 15 | * the process becomes multithreaded and thus must happen before the main |
| 16 | * constructor of liblttng-ust starts threads. Since there is no reliable way |
| 17 | * to guarantee the execution order of constructors across shared library, the |
| 18 | * liblttng-ust constructor has to call the malloc constructor before starting |
| 19 | * any thread. This is achieved by having a weak public version of this |
| 20 | * function in liblttng-ust that is overridden by the one in |
| 21 | * liblttng-ust-wrapper-libc when it's preloaded. |
| 22 | */ |
| 23 | void lttng_ust_libc_wrapper_malloc_ctor(void) |
| 24 | __attribute__((constructor)); |
| 25 | |
| 26 | #endif |