Commit | Line | Data |
---|---|---|
d1f1110f MJ |
1 | /* |
2 | * SPDX-License-Identifier: MIT | |
3 | * | |
4 | * Copyright (C) 2020 Michael Jeanson <mjeanson@efficios.com> | |
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 | */ | |
fca97dfd | 23 | void lttng_ust_libc_wrapper_malloc_ctor(void) |
465a0d04 | 24 | __attribute__((constructor)); |
d1f1110f MJ |
25 | |
26 | #endif |