Changeset View
Changeset View
Standalone View
Standalone View
head/contrib/jemalloc/FREEBSD-diffs
diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in | diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in | ||||
index 1e12fd3a..c42a7e10 100644 | index 7fecda7c..d5ca5e86 100644 | ||||
--- a/doc/jemalloc.xml.in | --- a/doc/jemalloc.xml.in | ||||
+++ b/doc/jemalloc.xml.in | +++ b/doc/jemalloc.xml.in | ||||
@@ -53,11 +53,22 @@ | @@ -53,11 +53,22 @@ | ||||
<para>This manual describes jemalloc @jemalloc_version@. More information | <para>This manual describes jemalloc @jemalloc_version@. More information | ||||
can be found at the <ulink | can be found at the <ulink | ||||
url="http://jemalloc.net/">jemalloc website</ulink>.</para> | url="http://jemalloc.net/">jemalloc website</ulink>.</para> | ||||
+ | + | ||||
+ <para>The following configuration options are enabled in libc's built-in | + <para>The following configuration options are enabled in libc's built-in | ||||
Show All 10 Lines | <refsynopsisdiv> | ||||
<title>SYNOPSIS</title> | <title>SYNOPSIS</title> | ||||
<funcsynopsis> | <funcsynopsis> | ||||
- <funcsynopsisinfo>#include <<filename class="headerfile">jemalloc/jemalloc.h</filename>></funcsynopsisinfo> | - <funcsynopsisinfo>#include <<filename class="headerfile">jemalloc/jemalloc.h</filename>></funcsynopsisinfo> | ||||
+ <funcsynopsisinfo>#include <<filename class="headerfile">stdlib.h</filename>> | + <funcsynopsisinfo>#include <<filename class="headerfile">stdlib.h</filename>> | ||||
+#include <<filename class="headerfile">malloc_np.h</filename>></funcsynopsisinfo> | +#include <<filename class="headerfile">malloc_np.h</filename>></funcsynopsisinfo> | ||||
<refsect2> | <refsect2> | ||||
<title>Standard API</title> | <title>Standard API</title> | ||||
<funcprototype> | <funcprototype> | ||||
@@ -3376,4 +3387,18 @@ malloc_conf = "narenas:1";]]></programlisting></para> | @@ -3510,4 +3521,18 @@ malloc_conf = "narenas:1";]]></programlisting></para> | ||||
<para>The <function>posix_memalign()</function> function conforms | <para>The <function>posix_memalign()</function> function conforms | ||||
to IEEE Std 1003.1-2001 (<quote>POSIX.1</quote>).</para> | to IEEE Std 1003.1-2001 (<quote>POSIX.1</quote>).</para> | ||||
</refsect1> | </refsect1> | ||||
+ <refsect1 id="history"> | + <refsect1 id="history"> | ||||
+ <title>HISTORY</title> | + <title>HISTORY</title> | ||||
+ <para>The <function>malloc_usable_size()</function> and | + <para>The <function>malloc_usable_size()</function> and | ||||
+ <function>posix_memalign()</function> functions first appeared in FreeBSD | + <function>posix_memalign()</function> functions first appeared in FreeBSD | ||||
+ 7.0.</para> | + 7.0.</para> | ||||
+ | + | ||||
+ <para>The <function>aligned_alloc()</function>, | + <para>The <function>aligned_alloc()</function>, | ||||
+ <function>malloc_stats_print()</function>, and | + <function>malloc_stats_print()</function>, and | ||||
+ <function>mallctl*()</function> functions first appeared in FreeBSD | + <function>mallctl*()</function> functions first appeared in FreeBSD | ||||
+ 10.0.</para> | + 10.0.</para> | ||||
+ | + | ||||
+ <para>The <function>*allocx()</function> functions first appeared in FreeBSD | + <para>The <function>*allocx()</function> functions first appeared in FreeBSD | ||||
+ 11.0.</para> | + 11.0.</para> | ||||
+ </refsect1> | + </refsect1> | ||||
</refentry> | </refentry> | ||||
diff --git a/include/jemalloc/internal/hooks.h b/include/jemalloc/internal/hooks.h | |||||
index cd49afcb..85e2a991 100644 | |||||
--- a/include/jemalloc/internal/hooks.h | |||||
+++ b/include/jemalloc/internal/hooks.h | |||||
@@ -6,13 +6,6 @@ extern JEMALLOC_EXPORT void (*hooks_libc_hook)(); | |||||
#define JEMALLOC_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn) | |||||
-#define open JEMALLOC_HOOK(open, hooks_libc_hook) | |||||
-#define read JEMALLOC_HOOK(read, hooks_libc_hook) | |||||
-#define write JEMALLOC_HOOK(write, hooks_libc_hook) | |||||
-#define readlink JEMALLOC_HOOK(readlink, hooks_libc_hook) | |||||
-#define close JEMALLOC_HOOK(close, hooks_libc_hook) | |||||
-#define creat JEMALLOC_HOOK(creat, hooks_libc_hook) | |||||
-#define secure_getenv JEMALLOC_HOOK(secure_getenv, hooks_libc_hook) | |||||
/* Note that this is undef'd and re-define'd in src/prof.c. */ | |||||
#define _Unwind_Backtrace JEMALLOC_HOOK(_Unwind_Backtrace, hooks_libc_hook) | |||||
diff --git a/include/jemalloc/internal/jemalloc_internal_decls.h b/include/jemalloc/internal/jemalloc_internal_decls.h | diff --git a/include/jemalloc/internal/jemalloc_internal_decls.h b/include/jemalloc/internal/jemalloc_internal_decls.h | ||||
index be70df51..84cd70da 100644 | index 7d6053e2..a0e4f5af 100644 | ||||
--- a/include/jemalloc/internal/jemalloc_internal_decls.h | --- a/include/jemalloc/internal/jemalloc_internal_decls.h | ||||
+++ b/include/jemalloc/internal/jemalloc_internal_decls.h | +++ b/include/jemalloc/internal/jemalloc_internal_decls.h | ||||
@@ -1,6 +1,9 @@ | @@ -1,6 +1,9 @@ | ||||
#ifndef JEMALLOC_INTERNAL_DECLS_H | #ifndef JEMALLOC_INTERNAL_DECLS_H | ||||
#define JEMALLOC_INTERNAL_DECLS_H | #define JEMALLOC_INTERNAL_DECLS_H | ||||
+#include "libc_private.h" | +#include "libc_private.h" | ||||
+#include "namespace.h" | +#include "namespace.h" | ||||
+ | + | ||||
#include <math.h> | #include <math.h> | ||||
#ifdef _WIN32 | #ifdef _WIN32 | ||||
# include <windows.h> | # include <windows.h> | ||||
diff --git a/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h b/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h | |||||
new file mode 100644 | |||||
index 00000000..0dab1296 | |||||
--- /dev/null | |||||
+++ b/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h | |||||
@@ -0,0 +1,9 @@ | |||||
+#ifndef __clang__ | |||||
+# undef JEMALLOC_INTERNAL_UNREACHABLE | |||||
+# define JEMALLOC_INTERNAL_UNREACHABLE abort | |||||
+ | |||||
+# undef JEMALLOC_C11_ATOMICS | |||||
+# undef JEMALLOC_GCC_ATOMIC_ATOMICS | |||||
+# undef JEMALLOC_GCC_U8_ATOMIC_ATOMICS | |||||
+# undef JEMALLOC_GCC_U8_SYNC_ATOMICS | |||||
+#endif | |||||
diff --git a/include/jemalloc/internal/jemalloc_preamble.h.in b/include/jemalloc/internal/jemalloc_preamble.h.in | diff --git a/include/jemalloc/internal/jemalloc_preamble.h.in b/include/jemalloc/internal/jemalloc_preamble.h.in | ||||
index e621fbc8..dbdd5d6b 100644 | index 3418cbfa..53e30dc4 100644 | ||||
--- a/include/jemalloc/internal/jemalloc_preamble.h.in | --- a/include/jemalloc/internal/jemalloc_preamble.h.in | ||||
+++ b/include/jemalloc/internal/jemalloc_preamble.h.in | +++ b/include/jemalloc/internal/jemalloc_preamble.h.in | ||||
@@ -8,6 +8,9 @@ | @@ -8,6 +8,9 @@ | ||||
#include <sys/ktrace.h> | #include <sys/ktrace.h> | ||||
#endif | #endif | ||||
+#include "un-namespace.h" | +#include "un-namespace.h" | ||||
+#include "libc_private.h" | +#include "libc_private.h" | ||||
Show All 12 Lines | |||||
- false | - false | ||||
-#endif | -#endif | ||||
- ; | - ; | ||||
+static const bool config_lazy_lock = true; | +static const bool config_lazy_lock = true; | ||||
static const char * const config_malloc_conf = JEMALLOC_CONFIG_MALLOC_CONF; | static const char * const config_malloc_conf = JEMALLOC_CONFIG_MALLOC_CONF; | ||||
static const bool config_prof = | static const bool config_prof = | ||||
#ifdef JEMALLOC_PROF | #ifdef JEMALLOC_PROF | ||||
diff --git a/include/jemalloc/internal/mutex.h b/include/jemalloc/internal/mutex.h | diff --git a/include/jemalloc/internal/mutex.h b/include/jemalloc/internal/mutex.h | ||||
index 6520c251..0013cbe9 100644 | index 7c24f072..94af1618 100644 | ||||
--- a/include/jemalloc/internal/mutex.h | --- a/include/jemalloc/internal/mutex.h | ||||
+++ b/include/jemalloc/internal/mutex.h | +++ b/include/jemalloc/internal/mutex.h | ||||
@@ -121,9 +121,6 @@ struct malloc_mutex_s { | @@ -135,9 +135,6 @@ struct malloc_mutex_s { | ||||
#ifdef JEMALLOC_LAZY_LOCK | #ifdef JEMALLOC_LAZY_LOCK | ||||
extern bool isthreaded; | extern bool isthreaded; | ||||
-#else | -#else | ||||
-# undef isthreaded /* Undo private_namespace.h definition. */ | -# undef isthreaded /* Undo private_namespace.h definition. */ | ||||
-# define isthreaded true | -# define isthreaded true | ||||
#endif | #endif | ||||
bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, | bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, | ||||
@@ -131,6 +128,7 @@ bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, | @@ -145,6 +142,7 @@ bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, | ||||
void malloc_mutex_prefork(tsdn_t *tsdn, malloc_mutex_t *mutex); | void malloc_mutex_prefork(tsdn_t *tsdn, malloc_mutex_t *mutex); | ||||
void malloc_mutex_postfork_parent(tsdn_t *tsdn, malloc_mutex_t *mutex); | void malloc_mutex_postfork_parent(tsdn_t *tsdn, malloc_mutex_t *mutex); | ||||
void malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex); | void malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex); | ||||
+bool malloc_mutex_first_thread(void); | +bool malloc_mutex_first_thread(void); | ||||
bool malloc_mutex_boot(void); | bool malloc_mutex_boot(void); | ||||
void malloc_mutex_prof_data_reset(tsdn_t *tsdn, malloc_mutex_t *mutex); | void malloc_mutex_prof_data_reset(tsdn_t *tsdn, malloc_mutex_t *mutex); | ||||
diff --git a/include/jemalloc/internal/test_hooks.h b/include/jemalloc/internal/test_hooks.h | |||||
index a6351e59..0780c52f 100644 | |||||
--- a/include/jemalloc/internal/test_hooks.h | |||||
+++ b/include/jemalloc/internal/test_hooks.h | |||||
@@ -6,13 +6,6 @@ extern JEMALLOC_EXPORT void (*test_hooks_libc_hook)(); | |||||
#define JEMALLOC_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn) | |||||
-#define open JEMALLOC_HOOK(open, test_hooks_libc_hook) | |||||
-#define read JEMALLOC_HOOK(read, test_hooks_libc_hook) | |||||
-#define write JEMALLOC_HOOK(write, test_hooks_libc_hook) | |||||
-#define readlink JEMALLOC_HOOK(readlink, test_hooks_libc_hook) | |||||
-#define close JEMALLOC_HOOK(close, test_hooks_libc_hook) | |||||
-#define creat JEMALLOC_HOOK(creat, test_hooks_libc_hook) | |||||
-#define secure_getenv JEMALLOC_HOOK(secure_getenv, test_hooks_libc_hook) | |||||
/* Note that this is undef'd and re-define'd in src/prof.c. */ | |||||
#define _Unwind_Backtrace JEMALLOC_HOOK(_Unwind_Backtrace, test_hooks_libc_hook) | |||||
diff --git a/include/jemalloc/internal/tsd.h b/include/jemalloc/internal/tsd.h | diff --git a/include/jemalloc/internal/tsd.h b/include/jemalloc/internal/tsd.h | ||||
index 0b9841aa..f03eee61 100644 | index 9ba26004..ecfda5d6 100644 | ||||
--- a/include/jemalloc/internal/tsd.h | --- a/include/jemalloc/internal/tsd.h | ||||
+++ b/include/jemalloc/internal/tsd.h | +++ b/include/jemalloc/internal/tsd.h | ||||
@@ -122,7 +122,8 @@ struct tsd_s { | @@ -198,7 +198,8 @@ struct tsd_s { | ||||
t use_a_getter_or_setter_instead_##n; | t TSD_MANGLE(n); | ||||
MALLOC_TSD | MALLOC_TSD | ||||
#undef O | #undef O | ||||
-}; | -}; | ||||
+/* AddressSanitizer requires TLS data to be aligned to at least 8 bytes. */ | +/* AddressSanitizer requires TLS data to be aligned to at least 8 bytes. */ | ||||
+} JEMALLOC_ALIGNED(16); | +} JEMALLOC_ALIGNED(16); | ||||
/* | JEMALLOC_ALWAYS_INLINE uint8_t | ||||
* Wrapper around tsd_t that makes it possible to avoid implicit conversion | tsd_state_get(tsd_t *tsd) { | ||||
diff --git a/include/jemalloc/jemalloc_FreeBSD.h b/include/jemalloc/jemalloc_FreeBSD.h | diff --git a/include/jemalloc/jemalloc_FreeBSD.h b/include/jemalloc/jemalloc_FreeBSD.h | ||||
new file mode 100644 | new file mode 100644 | ||||
index 00000000..b752b0e7 | index 00000000..b752b0e7 | ||||
--- /dev/null | --- /dev/null | ||||
+++ b/include/jemalloc/jemalloc_FreeBSD.h | +++ b/include/jemalloc/jemalloc_FreeBSD.h | ||||
@@ -0,0 +1,185 @@ | @@ -0,0 +1,185 @@ | ||||
+/* | +/* | ||||
+ * Override settings that were generated in jemalloc_defs.h as necessary. | + * Override settings that were generated in jemalloc_defs.h as necessary. | ||||
▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | |||||
@@ -19,4 +19,6 @@ done | @@ -19,4 +19,6 @@ done | ||||
cat <<EOF | cat <<EOF | ||||
#endif | #endif | ||||
+ | + | ||||
+#include "jemalloc_FreeBSD.h" | +#include "jemalloc_FreeBSD.h" | ||||
EOF | EOF | ||||
diff --git a/src/jemalloc.c b/src/jemalloc.c | diff --git a/src/jemalloc.c b/src/jemalloc.c | ||||
index f93c16fa..e0ad297b 100644 | index ed13718d..fefb719a 100644 | ||||
--- a/src/jemalloc.c | --- a/src/jemalloc.c | ||||
+++ b/src/jemalloc.c | +++ b/src/jemalloc.c | ||||
@@ -21,6 +21,10 @@ | @@ -23,6 +23,10 @@ | ||||
/******************************************************************************/ | /******************************************************************************/ | ||||
/* Data. */ | /* Data. */ | ||||
+/* Work around <http://llvm.org/bugs/show_bug.cgi?id=12623>: */ | +/* Work around <http://llvm.org/bugs/show_bug.cgi?id=12623>: */ | ||||
+const char *__malloc_options_1_0 = NULL; | +const char *__malloc_options_1_0 = NULL; | ||||
+__sym_compat(_malloc_options, __malloc_options_1_0, FBSD_1.0); | +__sym_compat(_malloc_options, __malloc_options_1_0, FBSD_1.0); | ||||
+ | + | ||||
/* Runtime configuration options. */ | /* Runtime configuration options. */ | ||||
const char *je_malloc_conf | const char *je_malloc_conf | ||||
#ifndef _WIN32 | #ifndef _WIN32 | ||||
@@ -3160,6 +3164,103 @@ je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr) { | @@ -2660,25 +2664,6 @@ je_realloc(void *ptr, size_t arg_size) { | ||||
LOG("core.realloc.entry", "ptr: %p, size: %zu\n", ptr, size); | |||||
if (unlikely(size == 0)) { | |||||
- if (ptr != NULL) { | |||||
- /* realloc(ptr, 0) is equivalent to free(ptr). */ | |||||
- UTRACE(ptr, 0, 0); | |||||
- tcache_t *tcache; | |||||
- tsd_t *tsd = tsd_fetch(); | |||||
- if (tsd_reentrancy_level_get(tsd) == 0) { | |||||
- tcache = tcache_get(tsd); | |||||
- } else { | |||||
- tcache = NULL; | |||||
- } | |||||
- | |||||
- uintptr_t args[3] = {(uintptr_t)ptr, size}; | |||||
- hook_invoke_dalloc(hook_dalloc_realloc, ptr, args); | |||||
- | |||||
- ifree(tsd, ptr, tcache, true); | |||||
- | |||||
- LOG("core.realloc.exit", "result: %p", NULL); | |||||
- return NULL; | |||||
- } | |||||
size = 1; | |||||
} | |||||
@@ -3750,6 +3735,103 @@ je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr) { | |||||
* End non-standard functions. | |||||
*/ | */ | ||||
/******************************************************************************/ | /******************************************************************************/ | ||||
/* | +/* | ||||
+ * Begin compatibility functions. | + * Begin compatibility functions. | ||||
+ */ | + */ | ||||
+ | + | ||||
+#define ALLOCM_LG_ALIGN(la) (la) | +#define ALLOCM_LG_ALIGN(la) (la) | ||||
+#define ALLOCM_ALIGN(a) (ffsl(a)-1) | +#define ALLOCM_ALIGN(a) (ffsl(a)-1) | ||||
+#define ALLOCM_ZERO ((int)0x40) | +#define ALLOCM_ZERO ((int)0x40) | ||||
+#define ALLOCM_NO_MOVE ((int)0x80) | +#define ALLOCM_NO_MOVE ((int)0x80) | ||||
+ | + | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
+#undef ALLOCM_SUCCESS | +#undef ALLOCM_SUCCESS | ||||
+#undef ALLOCM_ERR_OOM | +#undef ALLOCM_ERR_OOM | ||||
+#undef ALLOCM_ERR_NOT_MOVED | +#undef ALLOCM_ERR_NOT_MOVED | ||||
+ | + | ||||
+/* | +/* | ||||
+ * End compatibility functions. | + * End compatibility functions. | ||||
+ */ | + */ | ||||
+/******************************************************************************/ | +/******************************************************************************/ | ||||
+/* | /* | ||||
* The following functions are used by threading libraries for protection of | * The following functions are used by threading libraries for protection of | ||||
* malloc during fork(). | * malloc during fork(). | ||||
*/ | @@ -3919,4 +4001,11 @@ jemalloc_postfork_child(void) { | ||||
@@ -3323,4 +3424,11 @@ jemalloc_postfork_child(void) { | |||||
ctl_postfork_child(tsd_tsdn(tsd)); | ctl_postfork_child(tsd_tsdn(tsd)); | ||||
} | } | ||||
+void | +void | ||||
+_malloc_first_thread(void) | +_malloc_first_thread(void) | ||||
+{ | +{ | ||||
+ | + | ||||
+ (void)malloc_mutex_first_thread(); | + (void)malloc_mutex_first_thread(); | ||||
+} | +} | ||||
+ | + | ||||
/******************************************************************************/ | /******************************************************************************/ | ||||
diff --git a/src/malloc_io.c b/src/malloc_io.c | diff --git a/src/malloc_io.c b/src/malloc_io.c | ||||
index 7bdc13f9..c8802c70 100644 | index d7cb0f52..cda589c4 100644 | ||||
--- a/src/malloc_io.c | --- a/src/malloc_io.c | ||||
+++ b/src/malloc_io.c | +++ b/src/malloc_io.c | ||||
@@ -75,6 +75,20 @@ wrtmessage(void *cbopaque, const char *s) { | @@ -75,6 +75,20 @@ wrtmessage(void *cbopaque, const char *s) { | ||||
JEMALLOC_EXPORT void (*je_malloc_message)(void *, const char *s); | JEMALLOC_EXPORT void (*je_malloc_message)(void *, const char *s); | ||||
+JEMALLOC_ATTR(visibility("hidden")) | +JEMALLOC_ATTR(visibility("hidden")) | ||||
+void | +void | ||||
+wrtmessage_1_0(const char *s1, const char *s2, const char *s3, const char *s4) { | +wrtmessage_1_0(const char *s1, const char *s2, const char *s3, const char *s4) { | ||||
+ | + | ||||
+ wrtmessage(NULL, s1); | + wrtmessage(NULL, s1); | ||||
+ wrtmessage(NULL, s2); | + wrtmessage(NULL, s2); | ||||
+ wrtmessage(NULL, s3); | + wrtmessage(NULL, s3); | ||||
+ wrtmessage(NULL, s4); | + wrtmessage(NULL, s4); | ||||
+} | +} | ||||
+ | + | ||||
+void (*__malloc_message_1_0)(const char *s1, const char *s2, const char *s3, | +void (*__malloc_message_1_0)(const char *s1, const char *s2, const char *s3, | ||||
+ const char *s4) = wrtmessage_1_0; | + const char *s4) = wrtmessage_1_0; | ||||
+__sym_compat(_malloc_message, __malloc_message_1_0, FBSD_1.0); | +__sym_compat(_malloc_message, __malloc_message_1_0, FBSD_1.0); | ||||
+ | + | ||||
/* | /* | ||||
* Wrapper around malloc_message() that avoids the need for | * Wrapper around malloc_message() that avoids the need for | ||||
* je_malloc_message(...) throughout the code. | * je_malloc_message(...) throughout the code. | ||||
diff --git a/src/mutex.c b/src/mutex.c | diff --git a/src/mutex.c b/src/mutex.c | ||||
index 30222b3e..b2c36283 100644 | index 3f920f5b..88a7730c 100644 | ||||
--- a/src/mutex.c | --- a/src/mutex.c | ||||
+++ b/src/mutex.c | +++ b/src/mutex.c | ||||
@@ -41,6 +41,17 @@ pthread_create(pthread_t *__restrict thread, | @@ -41,6 +41,17 @@ pthread_create(pthread_t *__restrict thread, | ||||
#ifdef JEMALLOC_MUTEX_INIT_CB | #ifdef JEMALLOC_MUTEX_INIT_CB | ||||
JEMALLOC_EXPORT int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex, | JEMALLOC_EXPORT int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex, | ||||
void *(calloc_cb)(size_t, size_t)); | void *(calloc_cb)(size_t, size_t)); | ||||
+ | + | ||||
+#pragma weak _pthread_mutex_init_calloc_cb | +#pragma weak _pthread_mutex_init_calloc_cb | ||||
+int | +int | ||||
+_pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex, | +_pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex, | ||||
+ void *(calloc_cb)(size_t, size_t)) | + void *(calloc_cb)(size_t, size_t)) | ||||
+{ | +{ | ||||
+ | + | ||||
+ return (((int (*)(pthread_mutex_t *, void *(*)(size_t, size_t))) | + return (((int (*)(pthread_mutex_t *, void *(*)(size_t, size_t))) | ||||
+ __libc_interposing[INTERPOS__pthread_mutex_init_calloc_cb])(mutex, | + __libc_interposing[INTERPOS__pthread_mutex_init_calloc_cb])(mutex, | ||||
+ calloc_cb)); | + calloc_cb)); | ||||
+} | +} | ||||
#endif | #endif | ||||
void | void | ||||
@@ -131,6 +142,16 @@ mutex_addr_comp(const witness_t *witness1, void *mutex1, | @@ -131,6 +142,16 @@ mutex_addr_comp(const witness_t *witness1, void *mutex1, | ||||
} | } | ||||
} | |||||
bool | +bool | ||||
+malloc_mutex_first_thread(void) { | +malloc_mutex_first_thread(void) { | ||||
+ | + | ||||
+#ifndef JEMALLOC_MUTEX_INIT_CB | +#ifndef JEMALLOC_MUTEX_INIT_CB | ||||
+ return (malloc_mutex_first_thread()); | + return (malloc_mutex_first_thread()); | ||||
+#else | +#else | ||||
+ return (false); | + return (false); | ||||
+#endif | +#endif | ||||
+} | +} | ||||
+ | + | ||||
+bool | bool | ||||
malloc_mutex_init(malloc_mutex_t *mutex, const char *name, | malloc_mutex_init(malloc_mutex_t *mutex, const char *name, | ||||
witness_rank_t rank, malloc_mutex_lock_order_t lock_order) { | witness_rank_t rank, malloc_mutex_lock_order_t lock_order) { | ||||
mutex_prof_data_init(&mutex->prof_data); |