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

Candidate fix for #1374 (wrong db.h include file for BDB versions of code.) Addresses #1374.

git-svn-id: file:///svn/toku/tokudb@8667 c7de825b-a66e-492c-adef-691d508d4ae1
parent d592348f
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
.DEFAULT_GOAL= default .DEFAULT_GOAL= default
TOKUROOT=./ TOKUROOT=./
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
default: build default: build
SRCDIRS = $(OS_CHOICE) newbrt src cxx utils db-benchmark-test db-benchmark-test-cxx SRCDIRS = $(OS_CHOICE) newbrt src cxx utils db-benchmark-test db-benchmark-test-cxx
......
...@@ -10,7 +10,7 @@ DEPEND_COMPILE += \ ...@@ -10,7 +10,7 @@ DEPEND_COMPILE += \
#end #end
HERE = cxx HERE = cxx
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
# #
# #
# OPTFLAGS = -O2 # OPTFLAGS = -O2
......
...@@ -11,7 +11,7 @@ DEPEND_COMPILE += \ ...@@ -11,7 +11,7 @@ DEPEND_COMPILE += \
#end #end
HERE = cxx/tests HERE = cxx/tests
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
SHOULD_FAIL = SHOULD_FAIL =
$(SHOULD_FAIL): MAYBEINVERTER=;test $$? -ne 0 $(SHOULD_FAIL): MAYBEINVERTER=;test $$? -ne 0
...@@ -31,7 +31,7 @@ TARGETS = $(patsubst %.cpp,%,$(SRCS)) ...@@ -31,7 +31,7 @@ TARGETS = $(patsubst %.cpp,%,$(SRCS))
# OPTFLAGS = -O0 # OPTFLAGS = -O0
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage # GCOV_FLAGS = -fprofile-arcs -ftest-coverage
CPPFLAGS = -I../ -I../../include -I../../linux CPPFLAGS = -I../ -I../../include -I../../linux -I$(TOKUROOT)toku_include
CXXFLAGS = -Wall $(OPTFLAGS) -g $(GCOV_FLAGS) CXXFLAGS = -Wall $(OPTFLAGS) -g $(GCOV_FLAGS)
LDLIBS = ../../lib/libtokudb_cxx.a ../../lib/libtokudb.a -lz -lpthread LDLIBS = ../../lib/libtokudb_cxx.a ../../lib/libtokudb.a -lz -lpthread
......
...@@ -16,7 +16,7 @@ DEPEND_COMPILE += \ ...@@ -16,7 +16,7 @@ DEPEND_COMPILE += \
SKIP_NORETURN=1 #Do not add the -Wmissing-noreturn flag SKIP_NORETURN=1 #Do not add the -Wmissing-noreturn flag
HERE = db-benchmark-test-cxx HERE = db-benchmark-test-cxx
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
BENCHDBS = bench.bdb/ bench.tokudb BENCHDBS = bench.bdb/ bench.tokudb
......
...@@ -17,18 +17,18 @@ DEPEND_COMPILE += \ ...@@ -17,18 +17,18 @@ DEPEND_COMPILE += \
SKIP_NORETURN=1 #Do not add the -Wmissing-noreturn flag SKIP_NORETURN=1 #Do not add the -Wmissing-noreturn flag
HERE = db-benchmark-test HERE = db-benchmark-test
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
BENCHDBS = bench.bdb/ bench.tokudb ptest*.dir/ x.dir/ xfast.dir/ BENCHDBS = bench.bdb/ bench.tokudb ptest*.dir/ x.dir/ xfast.dir/
ifdef BDBDIR ifdef BDBDIR
BDB_CPPFLAGS = -D_GNU_SOURCE -I$(BDBDIR)/include -I../include -I$(PORTABILITY_HEADERS) BDB_CPPFLAGS = -D_GNU_SOURCE -I$(BDBDIR)/include -I../include
BDB_LDFLAGS = -L$(BDBDIR)/lib -ldb -Wl,-rpath,$(BDBDIR)/lib $(LIBPORTABILITY) -lpthread BDB_LDFLAGS = -L$(BDBDIR)/lib -ldb -Wl,-rpath,$(BDBDIR)/lib $(LIBPORTABILITY) -lpthread
else else
BDB_CPPFLAGS = -I$(PORTABILITY_HEADERS) -I../include BDB_CPPFLAGS =
BDB_LDFLAGS = -ldb $(LIBPORTABILITY) BDB_LDFLAGS = -ldb $(LIBPORTABILITY)
endif endif
BDB_CPPFLAGS += -D_SVID_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 BDB_CPPFLAGS+=-D_SVID_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 -DBDB -I$(TOKUROOT)toku_include -I$(PORTABILITY_HEADERS)
TOKUDB=libtokudb.$(SOEXT) TOKUDB=libtokudb.$(SOEXT)
TDB_DLINK_FILES = $(TOKUROOT)lib/$(TOKUDB) TDB_DLINK_FILES = $(TOKUROOT)lib/$(TOKUDB)
...@@ -62,7 +62,7 @@ clean: ...@@ -62,7 +62,7 @@ clean:
rm -f $(TARGETS) rm -f $(TARGETS)
rm -rf $(BENCHDBS) rm -rf $(BENCHDBS)
$(TARGET_TDB) $(SCANSCAN_TDB): BIN_FROM_C_FLAGS += -DDIRSUF=tokudb -I$(PORTABILITY_HEADERS) -I../include $(TARGET_TDB) $(SCANSCAN_TDB): BIN_FROM_C_FLAGS+=-DDIRSUF=tokudb -I$(PORTABILITY_HEADERS) -I$(TOKUROOT)toku_include -I$(TOKUROOT)include
ifneq ($(PROF),) ifneq ($(PROF),)
USE_STATIC=1 USE_STATIC=1
......
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
/* Insert a bunch of stuff */ /* Insert a bunch of stuff */
#ifdef BDB
typedef unsigned int u_int;
#endif
#include <db.h>
#include <toku_portability.h> #include <toku_portability.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
...@@ -10,7 +14,6 @@ ...@@ -10,7 +14,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <db.h>
#if !defined(DB_YESOVERWRITE) #if !defined(DB_YESOVERWRITE)
#define DB_YESOVERWRITE 0 #define DB_YESOVERWRITE 0
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
.DEFAULT_GOAL=install .DEFAULT_GOAL=install
TOKUROOT=../ TOKUROOT=../
INCLUDEDIRS=-I$(TOKUROOT)include/linux include $(TOKUROOT)toku_include/Makefile.include
include $(TOKUROOT)include/Makefile.include
OPT_AROPT=-qnoipo #Disable ipo for lib creation even when optimization is on. OPT_AROPT=-qnoipo #Disable ipo for lib creation even when optimization is on.
......
...@@ -16,7 +16,7 @@ NEWBRT_BUNDLE = newbrt.bundle ...@@ -16,7 +16,7 @@ NEWBRT_BUNDLE = newbrt.bundle
LINK_FILES += $(NEWBRT) LINK_FILES += $(NEWBRT)
SKIP_NEWBRTRULE=1 SKIP_NEWBRTRULE=1
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
# When debugging, try: valgrind --show-reachable=yes --leak-check=full ./brt-test # When debugging, try: valgrind --show-reachable=yes --leak-check=full ./brt-test
...@@ -65,7 +65,7 @@ BRT_C_FILES = $(patsubst %,%.c,$(BRT_SOURCES)) ...@@ -65,7 +65,7 @@ BRT_C_FILES = $(patsubst %,%.c,$(BRT_SOURCES))
BRT_O_FILES = $(patsubst %,%.$(OEXT),$(BRT_SOURCES)) BRT_O_FILES = $(patsubst %,%.$(OEXT),$(BRT_SOURCES))
newbrt.$(OEXT): $(BRT_C_FILES) $(DEPEND_COMPILE) newbrt.$(OEXT): $(BRT_C_FILES) $(DEPEND_COMPILE)
$(CC) $(BRT_C_FILES) $(COMBINE_C) $(O_FROM_C_FLAGS) $(CC) -c $(BRT_C_FILES) $(COMBINE_C) $(CPPFLAGS) $(CFLAGS) $(OOUTPUT)$@
ifneq ($(CYGWIN),) ifneq ($(CYGWIN),)
......
NEWBRT_REGRESSION_TESTS = \
brt-serialize-test \
brt-test \
brt-test-cursor \
brt-test-cursor-2 \
brt-test-named-db \
brt-test0 \
brt-test1 \
brt-test2 \
brt-test3 \
brt-test4 \
brt-test5 \
cachetable-test \
cachetable-test2 \
fifo-test \
list-test \
log-test \
log-test2 \
log-test3 \
log-test4 \
log-test5 \
log-test6 \
omt-test \
test-assert \
test-brt-delete-both \
test-brt-overflow \
test-del-inorder \
test-inc-split \
test-primes \
test_oexcl \
test_toku_malloc_plain_free \
ybt-test \
# This line intentially kept commented so I can have a \ on the end of the previous line
NEWBRT_BINS = $(NEWBRT_REGRESSION_TESTS) \
benchmark-test \
brtdump \
tdb_logprint \
# This line intentially kept commented so I can have a \ on the end of the previous line
NEWBRT_HERE = $(ROOT)newbrt
NEWBRT_RBINS = $(patsubst %,$(NEWBRT_HERE)/%,$(NEWBRT_BINS))
BINS += $(NEWBRT_RBINS)
# Must include crc first
NEWBRT_FILES = \
crc \
brt-serialize \
brt-verify \
brt \
cachetable \
fifo \
fingerprint \
key \
leafentry \
log \
log_code \
memory \
mempool \
omt \
primes \
recover \
roll \
toku_assert \
ybt \
# keep this line so I can have a \ on the previous line
OFILES += $(NEWBRT_HERE)/newbrt.o
$(NEWBRT_HERE)/newbrt.o: CPPFLAGS += -I$(NEWBRT_HERE)
$(NEWBRT_HERE)/newbrt.o: $(patsubst %,$(NEWBRT_HERE)/%.c,$(NEWBRT_FILES))
cd $(NEWBRT_HERE);$(CC) -combine $(CFLAGS) $(CPPFLAGS) $(patsubst %,%.c,$(NEWBRT_FILES)) -c -o $@
$(NEWBRT_RBINS): $(NEWBRT_HERE)/newbrt.o
NEWBRT_NEED_HELPERS = test-inc-split test-del-inorder
$(patsubst %,$(NEWBRT_HERE)/%, $(NEWBRT_NEED_HELPERS)): $(NEWBRT_HERE)/brt-test-helpers.o
# Put the benchmarktest_256 first since it takes a long time (and we want to use parallelism in the make)
NEWBRT_CHECKS = \
benchmarktest_256 \
$(NEWBRT_REGRESSION_TESTS) \
# This line intentially kept commented so I can have a \ on the previous line
newbrt.checkdir: $(patsubst %,$(NEWBRT_HERE)/%.check, $(NEWBRT_CHECKS))
newbrt.builddir: $(OFILES) $(NEWBRT_RBINS)
$(NEWBRT_HERE)/benchmarktest_256.check: $(NEWBRT_HERE)/benchmark-test
cd $(NEWBRT_HERE); $(VGRIND) ./benchmark-test $(VERBVERBOSE) --valsize 256 --verify 1
#foo:
# echo $(NEWBRT_HERE)/benchmarktest_256.check
$(NEWBRT_HERE)/test-assert.check: $(NEWBRT_HERE)/test-assert
@# no arguments, should err
cd $(NEWBRT_HERE); $(VGRIND) ./test-assert > /dev/null 2>&1 ; test \($$?\)
@# one argument, not "ok" should err
@echo Expect an abort message:
$(NEWBRT_HERE); ($(VGRIND) ./test-assert notok) > test-assert.out 2>&1 ; test \($$?\)
@fgrep failed test-assert.out > /dev/null
@rm test-assert.out
@# one argument, "ok" should not error
$(NEWBRT_HERE)/ $(VGRIND) ./test-assert ok
.DEFAULT_GOAL=build .DEFAULT_GOAL=build
TOKUROOT=../../ TOKUROOT=../../
INCLUDEDIRS=-I. -I.. INCLUDEDIRS=-I. -I..
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
CPPFLAGS += -D_GNU_SOURCE CPPFLAGS+=-D_GNU_SOURCE
ifeq ($(CC),icc) ifeq ($(CC),icc)
SKIP_WARNING += $(ICC_NOWARN)1418 #Non static functions do not need prototypes. SKIP_WARNING += $(ICC_NOWARN)1418 #Non static functions do not need prototypes.
......
#include "toku_portability.h" #include "toku_portability.h"
#include "../include/rdtsc.h" #include "rdtsc.h"
#include "trace_mem.h" #include "trace_mem.h"
// customize this as required // customize this as required
......
...@@ -11,8 +11,8 @@ DEPEND_COMPILE += \ ...@@ -11,8 +11,8 @@ DEPEND_COMPILE += \
$(TOKUROOT)newbrt/log.c \ $(TOKUROOT)newbrt/log.c \
#End of line #End of line
ydbtrace.o tdbtrace.o: tdbtrace.h ydbtrace.o tdbtrace.o: tdbtrace.h
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
CPPFLAGS += -D_GNU_SOURCE -D_THREAD_SAFE CPPFLAGS+=-D_GNU_SOURCE -D_THREAD_SAFE
YDB=ydb.$(AEXT) YDB=ydb.$(AEXT)
TYDB=tydb.$(AEXT) TYDB=tydb.$(AEXT)
...@@ -68,6 +68,7 @@ libs: $(LIBRARIES) ; ...@@ -68,6 +68,7 @@ libs: $(LIBRARIES) ;
buildlocktrees: $(LOCKTREE) $(RANGETREE) ; buildlocktrees: $(LOCKTREE) $(RANGETREE) ;
$(OBJS) $(TOBJS): CPPFLAGS+=-I$(TOKUROOT)include
$(YDB): $(OBJS) $(YDB): $(OBJS)
$(TYDB): $(TOBJS) $(TYDB): $(TOBJS)
...@@ -122,6 +123,7 @@ clean: ...@@ -122,6 +123,7 @@ clean:
cd lock_tree && $(MAKE) clean cd lock_tree && $(MAKE) clean
cd range_tree && $(MAKE) clean cd range_tree && $(MAKE) clean
ydbtrace.$(OEXT): CPPFLAGS+=-DTOKUTRACE
ydbtrace.$(OEXT): ydb.c $(DEPEND_COMPILE) ydbtrace.$(OEXT): ydb.c $(DEPEND_COMPILE)
$(CC) $< $(O_FROM_C_FLAGS) -DTOKUTRACE $(CC) -c $< $(CPPFLAGS) $(CFLAGS) $(OOUTPUT)$@
SRC_HERE = $(ROOT)src
include $(ROOT)src/lock_tree/Makefile.include
include $(ROOT)src/range_tree/Makefile.include
include $(ROOT)src/tests/Makefile.include
OFILES += $(SRC_HERE)/lock_and_range_tree.o
$(SRC_HERE)/lock_and_range_tree.o: CPPFLAGS += -I$(LOCKTREE_HERE) -I$(LOCKTREE_HERE)/.. -I$(LOCKTREE_HERE)/../range_tree -I$(LOCKTREE_HERE)/../../include -I$(LOCKTREE_HERE)/../../newbrt
$(SRC_HERE)/lock_and_range_tree.o: $(patsubst %,$(LOCKTREE_HERE)/%.c,$(LOCKTREE_FILES)) $(patsubst %,$(RANGETREE_HERE)/%.c,$(RANGETREE_FILES))
$(CC) -combine $(CFLAGS) $(CPPFLAGS) $^ -c -o $@
SRC_FILES = ydb errors elocks lock_and_range_tree
SRC_OFILES = $(patsubst %, $(SRC_HERE)/%.o, $(SRC_FILES)) $(ROOT)newbrt/newbrt.o
LIBS += $(ROOT)lib/libtokudb.so $(ROOT)lib/libtokudb.a
$(ROOT)src/%.o: CPPFLAGS += -I$(ROOT)include -I$(ROOT)newbrt -I$(ROOT)src/lock_tree -I$(ROOT)src/range_tree
$(ROOT)lib/libtokudb.a: $(SRC_OFILES)
$(AR) rv $@ $^
$(ROOT)lib/libtokudb.$(LIBEXT): $(SRC_OFILES)
cc $^ $(SHARED) -o $@ $(CFLAGS) $(RPATHNAME)
...@@ -9,7 +9,7 @@ DEPEND_COMPILE+= \ ...@@ -9,7 +9,7 @@ DEPEND_COMPILE+= \
#end #end
SKIP_LOCKTREERULE=1 SKIP_LOCKTREERULE=1
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
LOCKTREE = locktree.$(AEXT) LOCKTREE = locktree.$(AEXT)
LOCKTREE_LINEAR = locktree_linear.$(AEXT) LOCKTREE_LINEAR = locktree_linear.$(AEXT)
...@@ -28,15 +28,17 @@ LIBRARIES=$(LOCKTREE_LINEAR) $(LOCKTREE_TLOG) $(LOCKTREE) # $(LOCKTREE_LOG) ...@@ -28,15 +28,17 @@ LIBRARIES=$(LOCKTREE_LINEAR) $(LOCKTREE_TLOG) $(LOCKTREE) # $(LOCKTREE_LOG)
$(LOCKTREE_TLOG): $(OBJS) locktree_nooverlap.$(OEXT) $(LOCKTREE_TLOG): $(OBJS) locktree_nooverlap.$(OEXT)
$(LOCKTREE_LOG) $(LOCKTREE_LINEAR): $(OBJS) locktree.$(OEXT) $(LOCKTREE_LOG) $(LOCKTREE_LINEAR): $(OBJS) locktree.$(OEXT)
locktree.$(OEXT) locktree_nooverlap.$(OEXT) $(OBJS): CPPFLAGS+=-I$(TOKUROOT)include
$(LOCKTREE): $(LOCKTREE_TLOG) $(LOCKTREE): $(LOCKTREE_TLOG)
cp $< $@ cp $< $@
.PHONY: build check .PHONY: build check
build: $(LIBRARIES) build: $(LIBRARIES)
locktree_nooverlap.$(OEXT): CPPFLAGS+=-DTOKU_RT_NOOVERLAPS
locktree_nooverlap.$(OEXT): locktree.c $(DEPEND_COMPILE) locktree_nooverlap.$(OEXT): locktree.c $(DEPEND_COMPILE)
$(CC) $< -DTOKU_RT_NOOVERLAPS $(O_FROM_C_FLAGS) $(CC) $< -c $(CPPFLAGS) $(CFLAGS) $(OOUTPUT)$@
build check clean: build check clean:
cd tests;$(MAKE) $@ cd tests;$(MAKE) $@
...@@ -10,7 +10,7 @@ DEPEND_COMPILE += \ ...@@ -10,7 +10,7 @@ DEPEND_COMPILE += \
DEPEND_COMPILE+= $(NEWBRT) DEPEND_COMPILE+= $(NEWBRT)
LINK_FILES=$(NEWBRT) LINK_FILES=$(NEWBRT)
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
ifeq ($(CC),icc) ifeq ($(CC),icc)
SKIP_WARNING += $(ICC_NOWARN)1418 #Non static functions do not need prototypes. SKIP_WARNING += $(ICC_NOWARN)1418 #Non static functions do not need prototypes.
......
...@@ -9,7 +9,7 @@ DEPEND_COMPILE+= \ ...@@ -9,7 +9,7 @@ DEPEND_COMPILE+= \
SKIP_RANGETREERULE=1 SKIP_RANGETREERULE=1
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
RANGETREE = rangetree.$(AEXT) RANGETREE = rangetree.$(AEXT)
RANGETREE_LINEAR = rangetree_linear.$(AEXT) RANGETREE_LINEAR = rangetree_linear.$(AEXT)
...@@ -27,6 +27,8 @@ $(RANGETREE_TLOG): log_nooverlap.$(OEXT) ...@@ -27,6 +27,8 @@ $(RANGETREE_TLOG): log_nooverlap.$(OEXT)
$(RANGETREE_LINEAR): linear.$(OEXT) $(RANGETREE_LINEAR): linear.$(OEXT)
$(RANGETREE_LOG): log.$(OEXT) $(RANGETREE_LOG): log.$(OEXT)
$(RANGETREE_TLOG) $(RANGETREE_LINEAR) $(RANGETREE_LOG): CPPFLAGS+=-I$(TOKUROOT)include
$(RANGETREE): $(RANGETREE_TLOG) $(RANGETREE): $(RANGETREE_TLOG)
cp $< $@ cp $< $@
......
...@@ -8,7 +8,7 @@ NEWBRT=$(TOKUROOT)newbrt/newbrt.$(AEXT) ...@@ -8,7 +8,7 @@ NEWBRT=$(TOKUROOT)newbrt/newbrt.$(AEXT)
DEPEND_COMPILE+=$(NEWBRT) DEPEND_COMPILE+=$(NEWBRT)
LINK_FILES=$(NEWBRT) LINK_FILES=$(NEWBRT)
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
ifeq ($(CC),icc) ifeq ($(CC),icc)
SKIP_WARNING += $(ICC_NOWARN)1418 #Non static functions do not need prototypes. SKIP_WARNING += $(ICC_NOWARN)1418 #Non static functions do not need prototypes.
...@@ -21,6 +21,7 @@ TLOG_TESTS = $(patsubst %.c,%.tlog$(BINSUF),$(SRCS)) ...@@ -21,6 +21,7 @@ TLOG_TESTS = $(patsubst %.c,%.tlog$(BINSUF),$(SRCS))
LIN_TESTS = $(patsubst %.c,%.lin$(BINSUF),$(SRCS)) LIN_TESTS = $(patsubst %.c,%.lin$(BINSUF),$(SRCS))
ALL_TESTS = $(LIN_TESTS) $(TLOG_TESTS) #$(LOG_TESTS) ALL_TESTS = $(LIN_TESTS) $(TLOG_TESTS) #$(LOG_TESTS)
$(ALL_TESTS): CPPFLAGS+=-I$(TOKUROOT)include
RUN_LOG_TESTS = $(patsubst %.log$(BINSUF),%.logrun,$(LOG_TESTS)) RUN_LOG_TESTS = $(patsubst %.log$(BINSUF),%.logrun,$(LOG_TESTS))
RUN_TLOG_TESTS = $(patsubst %.tlog$(BINSUF),%.tlogrun,$(TLOG_TESTS)) RUN_TLOG_TESTS = $(patsubst %.tlog$(BINSUF),%.tlogrun,$(TLOG_TESTS))
......
...@@ -17,7 +17,7 @@ static void ...@@ -17,7 +17,7 @@ static void
setup_tree (BOOL allow_overlaps, BOOL insert, int left, int right, int data) { setup_tree (BOOL allow_overlaps, BOOL insert, int left, int right, int data) {
int r; int r;
toku_range range; toku_range range;
r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
if (insert) { if (insert) {
......
...@@ -82,7 +82,7 @@ fail_malloc (size_t size) { ...@@ -82,7 +82,7 @@ fail_malloc (size_t size) {
errno = ENOMEM; errno = ENOMEM;
return NULL; return NULL;
} }
return malloc(size); return toku_malloc(size);
} }
static inline void static inline void
......
...@@ -14,7 +14,7 @@ int main(int argc, const char *argv[]) { ...@@ -14,7 +14,7 @@ int main(int argc, const char *argv[]) {
#ifdef TOKU_RT_NOOVERLAPS #ifdef TOKU_RT_NOOVERLAPS
if (allow_overlaps) continue; if (allow_overlaps) continue;
#endif #endif
r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
assert(tree!=NULL); assert(tree!=NULL);
...@@ -37,7 +37,7 @@ int main(int argc, const char *argv[]) { ...@@ -37,7 +37,7 @@ int main(int argc, const char *argv[]) {
mallocced = 0; mallocced = 0;
failon = i; failon = i;
r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps, r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps,
fail_malloc, free, realloc); fail_malloc, toku_free, toku_realloc);
CKERR2(r, ENOMEM); CKERR2(r, ENOMEM);
assert(tree==NULL); assert(tree==NULL);
......
...@@ -10,24 +10,24 @@ int main(int argc, const char *argv[]) { ...@@ -10,24 +10,24 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
/* Create tests */ /* Create tests */
r = toku_rt_create(NULL, int_cmp, TXNID_cmp, FALSE, malloc, free, realloc); r = toku_rt_create(NULL, int_cmp, TXNID_cmp, FALSE, toku_malloc, toku_free, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_rt_create(&tree, NULL, TXNID_cmp, FALSE, malloc, free, realloc); r = toku_rt_create(&tree, NULL, TXNID_cmp, FALSE, toku_malloc, toku_free, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
assert(tree == NULL); assert(tree == NULL);
r = toku_rt_create(&tree, int_cmp, NULL, FALSE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, NULL, FALSE, toku_malloc, toku_free, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, NULL, free, realloc); r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, NULL, toku_free, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, malloc, NULL, realloc); r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, toku_malloc, NULL, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, malloc, free, NULL); r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, toku_malloc, toku_free, NULL);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
assert(tree == NULL); assert(tree == NULL);
...@@ -40,7 +40,7 @@ int main(int argc, const char *argv[]) { ...@@ -40,7 +40,7 @@ int main(int argc, const char *argv[]) {
r = toku_rt_insert(NULL, &range); r = toku_rt_insert(NULL, &range);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
assert(tree != NULL); assert(tree != NULL);
...@@ -53,7 +53,7 @@ int main(int argc, const char *argv[]) { ...@@ -53,7 +53,7 @@ int main(int argc, const char *argv[]) {
r = toku_rt_delete(NULL, &range); r = toku_rt_delete(NULL, &range);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
assert(tree != NULL); assert(tree != NULL);
...@@ -70,7 +70,7 @@ int main(int argc, const char *argv[]) { ...@@ -70,7 +70,7 @@ int main(int argc, const char *argv[]) {
range.ends.right = (toku_point*)&stuff[1]; range.ends.right = (toku_point*)&stuff[1];
range.data = 0; range.data = 0;
r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
assert(tree != NULL); assert(tree != NULL);
...@@ -100,7 +100,7 @@ int main(int argc, const char *argv[]) { ...@@ -100,7 +100,7 @@ int main(int argc, const char *argv[]) {
/* Predecessor tests */ /* Predecessor tests */
toku_point* foo = (toku_point*)&stuff[0]; toku_point* foo = (toku_point*)&stuff[0];
BOOL wasfound; BOOL wasfound;
r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
assert(tree != NULL); assert(tree != NULL);
...@@ -119,7 +119,7 @@ int main(int argc, const char *argv[]) { ...@@ -119,7 +119,7 @@ int main(int argc, const char *argv[]) {
r = toku_rt_close(tree); CKERR(r); r = toku_rt_close(tree); CKERR(r);
#ifndef TOKU_RT_NOOVERLAPS #ifndef TOKU_RT_NOOVERLAPS
r = toku_rt_create(&tree, int_cmp, TXNID_cmp, TRUE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, TXNID_cmp, TRUE, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
assert(tree != NULL); assert(tree != NULL);
...@@ -133,7 +133,7 @@ int main(int argc, const char *argv[]) { ...@@ -133,7 +133,7 @@ int main(int argc, const char *argv[]) {
/* Successor tests */ /* Successor tests */
r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
assert(tree != NULL); assert(tree != NULL);
...@@ -152,7 +152,7 @@ int main(int argc, const char *argv[]) { ...@@ -152,7 +152,7 @@ int main(int argc, const char *argv[]) {
r = toku_rt_close(tree); CKERR(r); r = toku_rt_close(tree); CKERR(r);
#ifndef TOKU_RT_NOOVERLAPS #ifndef TOKU_RT_NOOVERLAPS
r = toku_rt_create(&tree, int_cmp, TXNID_cmp, TRUE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, TXNID_cmp, TRUE, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
assert(tree != NULL); assert(tree != NULL);
...@@ -169,7 +169,7 @@ int main(int argc, const char *argv[]) { ...@@ -169,7 +169,7 @@ int main(int argc, const char *argv[]) {
r = toku_rt_get_allow_overlaps(NULL, &allowed); r = toku_rt_get_allow_overlaps(NULL, &allowed);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, TXNID_cmp, FALSE, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
assert(tree != NULL); assert(tree != NULL);
......
...@@ -21,7 +21,7 @@ int main(int argc, const char *argv[]) { ...@@ -21,7 +21,7 @@ int main(int argc, const char *argv[]) {
|-------B-------| |-------B-------|
*/ */
#ifndef TOKU_RT_NOOVERLAPS #ifndef TOKU_RT_NOOVERLAPS
r = toku_rt_create(&tree, int_cmp, char_cmp, TRUE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, char_cmp, TRUE, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
/* Verify we can insert a trivial range and lose it. */ /* Verify we can insert a trivial range and lose it. */
...@@ -112,7 +112,7 @@ int main(int argc, const char *argv[]) { ...@@ -112,7 +112,7 @@ int main(int argc, const char *argv[]) {
|---A---| |---A---|
|---B---| |---B---|
*/ */
r = toku_rt_create(&tree, int_cmp, char_cmp, FALSE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, char_cmp, FALSE, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
/* Verify we can insert a trivial range and lose it. */ /* Verify we can insert a trivial range and lose it. */
......
...@@ -12,7 +12,7 @@ static void* malloc_fail(size_t size) { ...@@ -12,7 +12,7 @@ static void* malloc_fail(size_t size) {
errno = ENOMEM; errno = ENOMEM;
return NULL; return NULL;
} else } else
return malloc(size); return toku_malloc(size);
} }
static void static void
...@@ -30,7 +30,7 @@ RunTest (BOOL f_overlaps_allowed) { ...@@ -30,7 +30,7 @@ RunTest (BOOL f_overlaps_allowed) {
/* Insert and delete lots of ranges to force memory increase and decrease */ /* Insert and delete lots of ranges to force memory increase and decrease */
r = toku_rt_create(&tree, int_cmp, char_cmp, f_overlaps_allowed, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, char_cmp, f_overlaps_allowed, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
/* Insert lots of ranges */ /* Insert lots of ranges */
...@@ -61,8 +61,8 @@ RunTest (BOOL f_overlaps_allowed) { ...@@ -61,8 +61,8 @@ RunTest (BOOL f_overlaps_allowed) {
/* Failure when allocating the tree */ /* Failure when allocating the tree */
malloc_cnt = 0; malloc_cnt = 0;
malloc_cntl = 1; malloc_cntl = 1;
r = toku_rt_create(&tree, int_cmp, char_cmp, f_overlaps_allowed, malloc_fail, free, r = toku_rt_create(&tree, int_cmp, char_cmp, f_overlaps_allowed, malloc_fail, toku_free,
realloc); toku_realloc);
CKERR2(r, ENOMEM); CKERR2(r, ENOMEM);
} }
......
...@@ -22,9 +22,9 @@ run_test (BOOL overlap_allowed) { ...@@ -22,9 +22,9 @@ run_test (BOOL overlap_allowed) {
int_cmp, int_cmp,
char_cmp, char_cmp,
overlap_allowed, overlap_allowed,
malloc, toku_malloc,
free, toku_free,
realloc toku_realloc
); );
CKERR(r); CKERR(r);
......
...@@ -40,7 +40,7 @@ int main(int argc, const char *argv[]) { ...@@ -40,7 +40,7 @@ int main(int argc, const char *argv[]) {
|-------A-------| |-------A-------|
|-------B-------| |-------B-------|
*/ */
r = toku_rt_create(&tree, int_cmp, char_cmp, TRUE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, char_cmp, TRUE, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
r = toku_rt_find(tree, &find_range, 4, &buf, &bufsize, &found); CKERR(r); r = toku_rt_find(tree, &find_range, 4, &buf, &bufsize, &found); CKERR(r);
...@@ -172,7 +172,7 @@ int main(int argc, const char *argv[]) { ...@@ -172,7 +172,7 @@ int main(int argc, const char *argv[]) {
/* Done */ /* Done */
r = toku_rt_close(tree); CKERR(r); r = toku_rt_close(tree); CKERR(r);
free(buf); toku_free(buf);
buf = NULL; buf = NULL;
#endif /* #ifdef TOKU_RT_NOOVERLAPS */ #endif /* #ifdef TOKU_RT_NOOVERLAPS */
...@@ -190,7 +190,7 @@ int main(int argc, const char *argv[]) { ...@@ -190,7 +190,7 @@ int main(int argc, const char *argv[]) {
find_range.left = (toku_point*)&nums[3]; find_range.left = (toku_point*)&nums[3];
find_range.right = (toku_point*)&nums[4]; find_range.right = (toku_point*)&nums[4];
r = toku_rt_create(&tree, int_cmp, char_cmp, FALSE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, char_cmp, FALSE, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
r = toku_rt_find(tree, &find_range, 4, &buf, &bufsize, &found); CKERR(r); r = toku_rt_find(tree, &find_range, 4, &buf, &bufsize, &found); CKERR(r);
......
...@@ -10,8 +10,8 @@ DEPEND_COMPILE += \ ...@@ -10,8 +10,8 @@ DEPEND_COMPILE += \
test.h \ test.h \
#end #end
SKIP_NORETURN=1 #Do not add the -Wmissing-noreturn flag SKIP_NORETURN=1 #Do not add the -Wmissing-noreturn flag
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
CPPFLAGS += -D_GNU_SOURCE CPPFLAGS+=-D_GNU_SOURCE
LIBTDB=../libtokudb.$(SOEXT) LIBTDB=../libtokudb.$(SOEXT)
TLIBTDB=../libtokudbtrace.$(SOEXT) TLIBTDB=../libtokudbtrace.$(SOEXT)
...@@ -165,6 +165,7 @@ endif ...@@ -165,6 +165,7 @@ endif
%.tdbt$(BINSUF): DLINK_FILES+=$(TLIBTDB) %.tdbt$(BINSUF): DLINK_FILES+=$(TLIBTDB)
%.tdbt$(BINSUF): RPATH_DIRS+=$(dir $(TLIBTDB)) %.tdbt$(BINSUF): RPATH_DIRS+=$(dir $(TLIBTDB))
%.tdb$(BINSUF) %.tdbt$(BINSUF): CFLAGS+= -DENVDIR=\"dir.$<.tdb\" -DUSE_TDB -DIS_TDB=1 %.tdb$(BINSUF) %.tdbt$(BINSUF): CFLAGS+= -DENVDIR=\"dir.$<.tdb\" -DUSE_TDB -DIS_TDB=1
%.tdb$(BINSUF) %.tdbt$(BINSUF): CPPFLAGS+=-I$(TOKUROOT)include
%.tdb$(BINSUF) %.tdbt$(BINSUF): %.c $(DEPEND_COMPILE) $(DEPEND_LINK) %.tdb$(BINSUF) %.tdbt$(BINSUF): %.c $(DEPEND_COMPILE) $(DEPEND_LINK)
$(CC) $< $(filter-out ../../lib/libtokuportability.a,$(BIN_FROM_C_FLAGS)) $(CC) $< $(filter-out ../../lib/libtokuportability.a,$(BIN_FROM_C_FLAGS))
......
...@@ -72,6 +72,8 @@ test1 (void) ...@@ -72,6 +72,8 @@ test1 (void)
r = db_env_set_func_realloc(brealloc); assert(r==0); r = db_env_set_func_realloc(brealloc); assert(r==0);
r = db_env_set_func_free(bfree); assert(r==0); r = db_env_set_func_free(bfree); assert(r==0);
#ifdef USE_TDB
// toku_malloc isn't affected by calling the BDB set_fun_malloc calls.
malloc_counter = realloc_counter = free_counter = 0; malloc_counter = realloc_counter = free_counter = 0;
{ {
...@@ -80,7 +82,6 @@ test1 (void) ...@@ -80,7 +82,6 @@ test1 (void)
toku_free(x); assert(malloc_counter==1 && free_counter==1 && realloc_counter==1); toku_free(x); assert(malloc_counter==1 && free_counter==1 && realloc_counter==1);
} }
#ifdef USE_TDB
r = db_env_set_func_malloc(dlmalloc); assert(r==0); r = db_env_set_func_malloc(dlmalloc); assert(r==0);
r = db_env_set_func_realloc(dlrealloc); assert(r==0); r = db_env_set_func_realloc(dlrealloc); assert(r==0);
r = db_env_set_func_free(dlfree); assert(r==0); r = db_env_set_func_free(dlfree); assert(r==0);
......
...@@ -69,7 +69,7 @@ else ifeq ($(VERBOSE),1) ...@@ -69,7 +69,7 @@ else ifeq ($(VERBOSE),1)
MAYBEATSIGN=@ MAYBEATSIGN=@
endif endif
CPPFLAGS = $(INCLUDEDIRS) -I$(PORTABILITY_HEADERS) -I$(TOKUROOT)include CPPFLAGS = $(INCLUDEDIRS) -I$(PORTABILITY_HEADERS) -I$(TOKUROOT)toku_include
#CFLAG default options #CFLAG default options
# Add -Wconversion #DISABLED for now. # Add -Wconversion #DISABLED for now.
...@@ -111,9 +111,9 @@ OPT_ARFLAGS=cr ...@@ -111,9 +111,9 @@ OPT_ARFLAGS=cr
LINK=-l LINK=-l
DEPEND_COMPILE += \ DEPEND_COMPILE += \
$(TOKUROOT)include/db.h \ $(TOKUROOT)include/db.h \
$(TOKUROOT)include/toku_os.h \ $(TOKUROOT)toku_include/toku_os.h \
$(TOKUROOT)include/toku_portability.h \ $(TOKUROOT)toku_include/toku_portability.h \
$(TOKUROOT)include/rdtsc.h \ $(TOKUROOT)toku_include/rdtsc.h \
# keep this line so I can have a \ on the previous line # keep this line so I can have a \ on the previous line
CCQUIET= CCQUIET=
...@@ -260,7 +260,7 @@ LDFLAGS += -$(CRUNTIME) ...@@ -260,7 +260,7 @@ LDFLAGS += -$(CRUNTIME)
CFLAGS += -$(CRUNTIME) CFLAGS += -$(CRUNTIME)
endif endif
# Need XOPEN_SOURCE=600 to get strtoll() # Need XOPEN_SOURCE=600 to get strtoll()
CPPFLAGS += -D_SVID_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 CPPFLAGS+=-D_SVID_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600
#TODO: Fix this up if we want to keep using CIL. #TODO: Fix this up if we want to keep using CIL.
#ifeq ($(CIL),1) #ifeq ($(CIL),1)
...@@ -359,9 +359,8 @@ BIN_FROM_O_FLAGS_NOLIB=$(CFLAGS) $(CPPFLAGS) $(BINOUTPUT)$@ $(LDFLAGS_NOLIB) ...@@ -359,9 +359,8 @@ BIN_FROM_O_FLAGS_NOLIB=$(CFLAGS) $(CPPFLAGS) $(BINOUTPUT)$@ $(LDFLAGS_NOLIB)
%$(BINSUF):%.$(OEXT) $(DEPEND_COMPILE) $(DEPEND_LINK) %$(BINSUF):%.$(OEXT) $(DEPEND_COMPILE) $(DEPEND_LINK)
$(CC) $< $(BIN_FROM_O_FLAGS) $(CC) $< $(BIN_FROM_O_FLAGS)
O_FROM_C_FLAGS= $(CFLAGS) $(CPPFLAGS) -c $(OOUTPUT)$@
%.$(OEXT):%.c $(DEPEND_COMPILE) %.$(OEXT):%.c $(DEPEND_COMPILE)
$(CC) $< $(O_FROM_C_FLAGS) $(CC) $< -c $(CPPFLAGS) $(CFLAGS) $(OOUTPUT)$@
%.$(AEXT): %.$(AEXT):
$(AR) $(ARFLAGS) $(AROUTPUT)$@ $(filter %.$(OEXT),$^) $(patsubst %.bundle, %.bundle/*.$(OEXT), $(filter-out %.$(OEXT),$^)) $(AR) $(ARFLAGS) $(AROUTPUT)$@ $(filter %.$(OEXT),$^) $(patsubst %.bundle, %.bundle/*.$(OEXT), $(filter-out %.$(OEXT),$^))
......
...@@ -10,7 +10,7 @@ DEPEND_COMPILE += \ ...@@ -10,7 +10,7 @@ DEPEND_COMPILE += \
#end #end
HERE = utils HERE = utils
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
ifndef BDBDIR ifndef BDBDIR
BDBDIR=/usr/local/BerkeleyDB.4.4 BDBDIR=/usr/local/BerkeleyDB.4.4
endif endif
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
TOKUROOT=../ TOKUROOT=../
INCLUDEDIRS=-I. INCLUDEDIRS=-I.
SKIP_LIBPORTABILITYRULE=1 SKIP_LIBPORTABILITYRULE=1
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
OPT_AROPT=-qnoipo #Disable ipo for lib creation even when optimization is on. OPT_AROPT=-qnoipo #Disable ipo for lib creation even when optimization is on.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
.DEFAULT_GOAL=all .DEFAULT_GOAL=all
TOKUROOT=../../ TOKUROOT=../../
INCLUDEDIRS=-I$(TOKUROOT)include/windows -I$(TOKUROOT)newbrt INCLUDEDIRS=-I$(TOKUROOT)include/windows -I$(TOKUROOT)newbrt
include $(TOKUROOT)include/Makefile.include include $(TOKUROOT)toku_include/Makefile.include
SKIP_WARNING += $(ICC_NOWARN)1418 #Non static functions do not need prototypes. SKIP_WARNING += $(ICC_NOWARN)1418 #Non static functions do not need prototypes.
......
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