Commit f9ff91ab authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

Separate out the common malloc into newbrt/memory.c, and put the os-specific...

Separate out the common malloc into newbrt/memory.c, and put the os-specific stuff into windows and linux subdirs.  Things are broken. Addresses #1343.

git-svn-id: file:///svn/toku/tokudb.1032b+1343@8559 c7de825b-a66e-492c-adef-691d508d4ae1
parent 567444ec
......@@ -38,8 +38,9 @@ summarize: check
check: $(CHECKS)
clean: $(patsubst %,%.dir.clean,$(SRCDIRS))
$(MAYBEATSIGN)rm -rf lib/*.$(SOEXT) lib/*.$(AEXT)
clean: $(patsubst %,%.dir.clean,$(SRCDIRS)) cleanlib
cleanlib:
$(MAYBEATSIGN)rm -rf lib/*.$(SOEXT) lib/*.$(AEXT) lib/*.bundle
install:
./install.bash
......
......@@ -41,10 +41,6 @@
# To make warnings be warnngs instead of errors do
# make WERROR=
ifeq ($(filter --no-print-directory,$(MAKE)),)
MAKE+= --no-print-directory #Do not print 'entering directory' infomration.
endif
ifeq ($(DEBUG),)
DEBUG = 0
endif
......@@ -318,13 +314,13 @@ clean-default:
ifeq ($(SKIP_LIBPORTABILITYRULE),)
ifeq ($(CYGWIN),)
$(LIBPORTABILITY): $(TOKUROOT)linux/*.[ch]
$(MAYBEATSIGN)cd $(TOKUROOT)linux && $(MAKE) -s install
$(MAYBEATSIGN)cd $(TOKUROOT)linux && $(MAKE) install
else ifneq ($(CC),icc)
$(LIBPORTABILITY): $(TOKUROOT)linux/*.[ch]
$(MAYBEATSIGN)cd $(TOKUROOT)linux && $(MAKE) -s install
$(MAYBEATSIGN)cd $(TOKUROOT)linux && $(MAKE) install
else
$(LIBPORTABILITY): $(TOKUROOT)windows/*.[ch]
$(MAYBEATSIGN)cd $(TOKUROOT)windows && $(MAKE) -s install
$(MAYBEATSIGN)cd $(TOKUROOT)windows && $(MAKE) install
endif
endif
......@@ -334,7 +330,7 @@ LOCKTREE_LINEAR = $(TOKUROOT)src/lock_tree/locktree_linear.$(AEXT)
LOCKTREE_TLOG = $(TOKUROOT)src/lock_tree/locktree_tlog.$(AEXT)
LOCKTREE_LOG = $(TOKUROOT)src/lock_tree/locktree_log.$(AEXT)
$(LOCKTREE) $(LOCKTREE_LINEAR) $(LOCKTREE_TLOG) $(LOCKTREE_LOG): $(@D)*.[ch]
$(MAYBEATSIGN)cd $(@D) && $(MAKE) -s $(@F)
$(MAYBEATSIGN)cd $(@D) && $(MAKE) $(@F)
endif
ifeq ($(SKIP_RANGETREERULE),)
......@@ -343,19 +339,21 @@ RANGETREE_LINEAR = $(TOKUROOT)src/range_tree/rangetree_linear.$(AEXT)
RANGETREE_TLOG = $(TOKUROOT)src/range_tree/rangetree_tlog.$(AEXT)
RANGETREE_LOG = $(TOKUROOT)src/range_tree/rangetree_log.$(AEXT)
$(RANGETREE) $(RANGETREE_LINEAR) $(RANGETREE_TLOG) $(RANGETREE_LOG): $(@D)*.[ch]
$(MAYBEATSIGN)cd $(@D) && $(MAKE) -s $(@F)
$(MAYBEATSIGN)cd $(@D) && $(MAKE) $(@F)
endif
ifeq ($(SKIP_NEWBRTRULE),)
NEWBRT = $(TOKUROOT)newbrt/newbrt.$(AEXT)
NEWBRT_BUNDLE = $(TOKUROOT)newbrt/newbrt.bundle
$(NEWBRT): $(@D)*.[ch]
$(MAYBEATSIGN)cd $(@D) && $(MAKE) -s $(@F)
$(MAYBEATSIGN)cd $(@D) && $(MAKE) $(@F)
endif
BIN_FROM_C_FLAGS =$(CFLAGS) $(CPPFLAGS) $(BINOUTPUT)$@ $(LDFLAGS)
BIN_FROM_C_FLAGS_NOLIB=$(CFLAGS) $(CPPFLAGS) $(BINOUTPUT)$@ $(LDFLAGS_NOLIB)
%$(BINSUF):%.c $(DEPEND_COMPILE) $(DEPEND_LINK)
echo LDFLAGS $(LDFLAGS)
echo bin_from_c $(BIN_FROM_C_FLAGS)
$(MAYBEATSIGN)$(CC) $< $(BIN_FROM_C_FLAGS)
BIN_FROM_O_FLAGS =$(CFLAGS) $(CPPFLAGS) $(BINOUTPUT)$@ $(LDFLAGS)
......
......@@ -49,6 +49,7 @@ BRT_SOURCES = \
log \
log_code \
memarena \
memory \
mempool \
omt \
recover \
......@@ -100,7 +101,6 @@ bins: $(BINS)
check: bins
$(MAYBEATSIGN)cd tests;$(MAKE) check
%$(BINSUF): BIN_FROM_C_FLAGS+=$(LIBPORTABILITY)
%$(BINSUF): $(NEWBRT) $(LIBPORTABILITY)
checko2:
......
#include "toku_portability.h"
#include "toku_assert.h"
#include "memory.h"
#include <string.h>
#include <stdlib.h>
int toku_memory_check=0;
int toku_calloc_counter = 0;
int toku_malloc_counter = 0;
int toku_realloc_counter = 0;
int toku_free_counter = 0;
typedef void *(*malloc_fun_t)(size_t);
typedef void (*free_fun_t)(void*);
typedef void *(*realloc_fun_t)(void*,size_t);
static malloc_fun_t t_malloc = 0;
static free_fun_t t_free = 0;
static realloc_fun_t t_realloc = 0;
void *toku_malloc(size_t size) {
toku_malloc_counter++;
if (t_malloc)
......
......@@ -2,29 +2,12 @@
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "toku_portability.h"
#include "memory.h"
#include "assert.h"
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <errno.h>
int toku_memory_check=0;
int toku_calloc_counter = 0;
int toku_malloc_counter = 0;
int toku_realloc_counter = 0;
int toku_free_counter = 0;
typedef void *(*malloc_fun_t)(size_t);
typedef void (*free_fun_t)(void*);
typedef void *(*realloc_fun_t)(void*,size_t);
static malloc_fun_t t_malloc = 0;
static free_fun_t t_free = 0;
static realloc_fun_t t_realloc = 0;
static inline size_t resize(size_t n) {
if (n >= 1*1024*1024)
n = (n+7) & ~7; // round up to make windbg !heap happy
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment