Module Name: src
Committed By: christos
Date: Thu Sep 26 14:09:26 UTC 2024
Modified Files:
src/external/bsd/jemalloc/dist/src: jemalloc.c
src/external/bsd/jemalloc/include/jemalloc: jemalloc.h
Log Message:
Restore our changes:
1. Provide {g,s}etter methods to je_malloc_message, and je_malloc_conf
globals that we don't expose.
2. Create a new define JEMALLOC_PROTECT_NOSTD that allows us to protect
the non-standard jemalloc functions that the library provides by
prefixing them with __je instead of je so that they are not in the
user namespace. This requires a bit of shuffling to move the standard
malloc/posix_memaling/realloc/valloc to the non-rename section and dallocx
to the rename section.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/external/bsd/jemalloc/dist/src/jemalloc.c
cvs rdiff -u -r1.8 -r1.9 \
src/external/bsd/jemalloc/include/jemalloc/jemalloc.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/jemalloc/dist/src/jemalloc.c
diff -u src/external/bsd/jemalloc/dist/src/jemalloc.c:1.13 src/external/bsd/jemalloc/dist/src/jemalloc.c:1.14
--- src/external/bsd/jemalloc/dist/src/jemalloc.c:1.13 Mon Sep 23 11:03:42 2024
+++ src/external/bsd/jemalloc/dist/src/jemalloc.c Thu Sep 26 10:09:26 2024
@@ -4506,4 +4506,30 @@ _malloc_postfork_child(void)
ctl_postfork_child(tsd_tsdn(tsd));
}
+void (*
+je_malloc_message_get(void))(void *, const char *)
+{
+ return je_malloc_message;
+}
+
+void
+je_malloc_message_set(void (*m)(void *, const char *))
+{
+ je_malloc_message = m;
+}
+
+const char *
+je_malloc_conf_get(void)
+{
+ return je_malloc_conf;
+}
+
+void
+je_malloc_conf_set(const char *m)
+{
+ je_malloc_conf = m;
+}
+
+ /******************************************************************************/
+
/******************************************************************************/
Index: src/external/bsd/jemalloc/include/jemalloc/jemalloc.h
diff -u src/external/bsd/jemalloc/include/jemalloc/jemalloc.h:1.8 src/external/bsd/jemalloc/include/jemalloc/jemalloc.h:1.9
--- src/external/bsd/jemalloc/include/jemalloc/jemalloc.h:1.8 Mon Sep 23 17:08:37 2024
+++ src/external/bsd/jemalloc/include/jemalloc/jemalloc.h Thu Sep 26 10:09:26 2024
@@ -71,27 +71,53 @@ extern "C" {
#ifndef JEMALLOC_NO_RENAME
# define je_aligned_alloc aligned_alloc
# define je_calloc calloc
-# define je_dallocx dallocx
# define je_free free
+# define je_malloc malloc
+# define je_posix_memalign posix_memalign
+# define je_realloc realloc
+# define je_valloc valloc
+
+# ifndef JEMALLOC_PROTECT_NOSTD
+# define je_dallocx dallocx
# define je_mallctl mallctl
# define je_mallctlbymib mallctlbymib
# define je_mallctlnametomib mallctlnametomib
-# define je_malloc malloc
# define je_malloc_conf malloc_conf
+# define je_malloc_conf_get malloc_conf_get
+# define je_malloc_conf_set malloc_conf_set
# define je_malloc_conf_2_conf_harder malloc_conf_2_conf_harder
# define je_malloc_message malloc_message
+# define je_malloc_message_get malloc_message_get
+# define je_malloc_message_set malloc_message_set
# define je_malloc_stats_print malloc_stats_print
# define je_malloc_usable_size malloc_usable_size
# define je_mallocx mallocx
# define je_smallocx_54eaed1d8b56b1aa528be3bdd1877e59c56fa90c smallocx_54eaed1d8b56b1aa528be3bdd1877e59c56fa90c
# define je_nallocx nallocx
-# define je_posix_memalign posix_memalign
# define je_rallocx rallocx
-# define je_realloc realloc
# define je_sallocx sallocx
# define je_sdallocx sdallocx
# define je_xallocx xallocx
-# define je_valloc valloc
+# else
+# define je_dallocx __je_dallocx
+# define je_mallctl __je_mallctl
+# define je_mallctlbymib __je_mallctlbymib
+# define je_mallctlnametomib __je_mallctlnametomib
+# define je_malloc_conf __je_malloc_conf
+# define je_malloc_conf_get __je_malloc_conf_get
+# define je_malloc_conf_set __je_malloc_conf_set
+# define je_malloc_message __je_malloc_message
+# define je_malloc_message_get __je_malloc_message_get
+# define je_malloc_message_set __je_malloc_message_set
+# define je_malloc_stats_print __je_malloc_stats_print
+# define je_malloc_usable_size __je_malloc_usable_size
+# define je_mallocx __je_mallocx
+# define je_nallocx __je_nallocx
+# define je_rallocx __je_rallocx
+# define je_sallocx __je_sallocx
+# define je_sdallocx __je_sdallocx
+# define je_xallocx __je_xallocx
+# endif
#endif
#include <stdlib.h>
@@ -252,6 +278,12 @@ extern "C" {
extern JEMALLOC_EXPORT const char *je_malloc_conf;
extern JEMALLOC_EXPORT void (*je_malloc_message)(void *cbopaque,
const char *s);
+extern JEMALLOC_EXPORT const char *je_malloc_conf_get(void);
+extern JEMALLOC_EXPORT void je_malloc_conf_set(const char *);
+extern JEMALLOC_EXPORT void (*je_malloc_message_get(void))
+ (void *cbopaque, const char *s);
+extern JEMALLOC_EXPORT void je_malloc_message_set(
+ void (*)(void *cbopaque, const char *s));
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
void JEMALLOC_SYS_NOTHROW *je_malloc(size_t size)