summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'www-servers/monkeyd/files/monkeyd-1.5.2-use-system-jemalloc.patch')
-rw-r--r--www-servers/monkeyd/files/monkeyd-1.5.2-use-system-jemalloc.patch157
1 files changed, 157 insertions, 0 deletions
diff --git a/www-servers/monkeyd/files/monkeyd-1.5.2-use-system-jemalloc.patch b/www-servers/monkeyd/files/monkeyd-1.5.2-use-system-jemalloc.patch
new file mode 100644
index 000000000000..a4934a4e21c1
--- /dev/null
+++ b/www-servers/monkeyd/files/monkeyd-1.5.2-use-system-jemalloc.patch
@@ -0,0 +1,157 @@
+diff -Naur monkey-1.5.2.orig/configure monkey-1.5.2/configure
+--- monkey-1.5.2.orig/configure 2014-07-19 23:27:13.000000000 -0400
++++ monkey-1.5.2/configure 2014-07-26 10:07:08.808171546 -0400
+@@ -193,7 +193,7 @@
+
+ echo "+ Creating src/Makefile"
+ create_makefile2 mod_libs mod_obj make_script platform \
+- malloc_libc malloc_jemalloc
++ malloc_libc
+
+ echo "+ Creating plugins/Make.common"
+ create_plugins_make_common bindir
+@@ -210,33 +210,12 @@
+
+ echo -e "+ Creating Makefile"
+ if [ "$dir" = 0 ]; then
+- create_makefile1 bindir malloc_jemalloc
++ create_makefile1 bindir
+ else
+ create_makefile1_install prefix bindir mandir sysconfdir \
+- datadir logdir malloc_jemalloc
++ datadir logdir
+ fi
+
+- # if the memory allocator is jemalloc, lets start configuring the dependency
+- if [ $malloc_jemalloc -eq 1 ]; then
+- echo
+- echo -e "\033[1m=== Configuring Memory Allocator ===\033[0m"
+- cd deps/jemalloc
+- ./configure $JEMALLOC_OPTS \
+- --with-jemalloc-prefix=je_ \
+- --enable-cc-silence \
+- CFLAGS="-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " \
+- LDFLAGS="" > jemalloc.config 2>&1
+- if [ $? -eq 0 ]; then
+- echo "+ Jemalloc configured"
+- else
+- cat jemalloc.config
+- echo
+- echo "check more details with: $ cat deps/jemalloc/config.log"
+- exit 1
+- fi
+- cd ../../
+- fi
+-
+ echo
+ echo -e "\033[1m=== Monkey Configuration ===\033[0m"
+ echo -e "Platform\t= $platform"
+@@ -316,12 +295,6 @@
+ # Create Makefile
+ create_makefile1()
+ {
+- if [ $malloc_jemalloc -eq 1 ]; then
+- $deps="deps/jemalloc"
+- else
+- $deps=""
+- fi
+-
+ cat > Makefile << EOF
+ # Monkey HTTP Daemon: Makefile
+ # ============================
+@@ -459,13 +432,6 @@
+
+ create_makefile1_install()
+ {
+- # memory allocator
+- if [ $malloc_jemalloc -eq 1 ]; then
+- all_deps="$all_deps jemalloc"
+- else
+- deps=""
+- fi
+-
+ # remove old data
+ rm -rf plugins.conf plugins.list
+ touch plugins.conf
+@@ -523,10 +489,6 @@
+ @\$(MAKE) -s -C plugins all
+ @echo " DONE"
+
+-jemalloc:
+- @echo " CC jemalloc [all]"
+- @\$(MAKE) -s -C deps/jemalloc
+-
+ clean:
+ @(cd src; \$(MAKE) clean)
+ @(cd plugins; \$(MAKE) clean)
+@@ -605,9 +567,7 @@
+ fi
+
+ if [ $malloc_jemalloc -eq 1 ]; then
+- extra="../deps/jemalloc/lib/libjemalloc.a"
+- extraso="-Wl,--whole-archive ../deps/jemalloc/lib/libjemalloc_pic.a -Wl,--no-whole-archive"
+- libs="$libs -lm"
++ libs="$libs -ljemalloc"
+ fi
+
+ cat > src/Makefile<<EOF
+diff -Naur monkey-1.5.2.orig/src/include/mk_memory.h monkey-1.5.2/src/include/mk_memory.h
+--- monkey-1.5.2.orig/src/include/mk_memory.h 2014-07-19 23:27:13.000000000 -0400
++++ monkey-1.5.2/src/include/mk_memory.h 2014-07-26 10:08:06.427168785 -0400
+@@ -23,7 +23,7 @@
+ #include <stdio.h>
+
+ #ifdef MALLOC_JEMALLOC
+-#include "../../deps/jemalloc/include/jemalloc/jemalloc.h"
++#include <jemalloc/jemalloc.h>
+ #endif
+
+ #include "mk_macros.h"
+@@ -43,11 +43,7 @@
+ static inline ALLOCSZ_ATTR(1)
+ void *mk_mem_malloc(const size_t size)
+ {
+-#ifdef MALLOC_JEMALLOC
+- void *aux = je_malloc(size);
+-#else
+ void *aux = malloc(size);
+-#endif
+
+ if (mk_unlikely(!aux && size)) {
+ perror("malloc");
+@@ -60,11 +56,7 @@
+ static inline ALLOCSZ_ATTR(1)
+ void *mk_mem_malloc_z(const size_t size)
+ {
+-#ifdef MALLOC_JEMALLOC
+- void *buf = je_calloc(1, size);
+-#else
+ void *buf = calloc(1, size);
+-#endif
+
+ if (mk_unlikely(!buf)) {
+ return NULL;
+@@ -76,11 +68,7 @@
+ static inline ALLOCSZ_ATTR(2)
+ void *mk_mem_realloc(void *ptr, const size_t size)
+ {
+-#ifdef MALLOC_JEMALLOC
+- void *aux = je_realloc(ptr, size);
+-#else
+ void *aux = realloc(ptr, size);
+-#endif
+
+ if (mk_unlikely(!aux && size)) {
+ perror("realloc");
+@@ -92,11 +80,7 @@
+
+ static inline void mk_mem_free(void *ptr)
+ {
+-#ifdef MALLOC_JEMALLOC
+- je_free(ptr);
+-#else
+ free(ptr);
+-#endif
+ }
+
+ void mk_mem_free(void *ptr);