Commit 1be31059 authored by Dave Wells's avatar Dave Wells Committed by Yoni Fogel

merge DB_LOADER->abort changes from tokudb.2216a branch

git-svn-id: file:///svn/toku/tokudb@17320 c7de825b-a66e-492c-adef-691d508d4ae1
parent 19820643
...@@ -54,6 +54,7 @@ struct __toku_loader { ...@@ -54,6 +54,7 @@ struct __toku_loader {
int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */ int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */
int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */ int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */
int (*close)(DB_LOADER *loader); /* finish loading, free memory */ int (*close)(DB_LOADER *loader); /* finish loading, free memory */
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
}; };
typedef struct __toku_engine_status { typedef struct __toku_engine_status {
char now[26]; /* time of engine status query (i.e. now) */ char now[26]; /* time of engine status query (i.e. now) */
......
...@@ -54,6 +54,7 @@ struct __toku_loader { ...@@ -54,6 +54,7 @@ struct __toku_loader {
int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */ int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */
int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */ int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */
int (*close)(DB_LOADER *loader); /* finish loading, free memory */ int (*close)(DB_LOADER *loader); /* finish loading, free memory */
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
}; };
typedef struct __toku_engine_status { typedef struct __toku_engine_status {
char now[26]; /* time of engine status query (i.e. now) */ char now[26]; /* time of engine status query (i.e. now) */
......
...@@ -54,6 +54,7 @@ struct __toku_loader { ...@@ -54,6 +54,7 @@ struct __toku_loader {
int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */ int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */
int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */ int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */
int (*close)(DB_LOADER *loader); /* finish loading, free memory */ int (*close)(DB_LOADER *loader); /* finish loading, free memory */
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
}; };
typedef struct __toku_engine_status { typedef struct __toku_engine_status {
char now[26]; /* time of engine status query (i.e. now) */ char now[26]; /* time of engine status query (i.e. now) */
......
...@@ -54,6 +54,7 @@ struct __toku_loader { ...@@ -54,6 +54,7 @@ struct __toku_loader {
int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */ int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */
int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */ int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */
int (*close)(DB_LOADER *loader); /* finish loading, free memory */ int (*close)(DB_LOADER *loader); /* finish loading, free memory */
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
}; };
typedef struct __toku_engine_status { typedef struct __toku_engine_status {
char now[26]; /* time of engine status query (i.e. now) */ char now[26]; /* time of engine status query (i.e. now) */
......
...@@ -54,6 +54,7 @@ struct __toku_loader { ...@@ -54,6 +54,7 @@ struct __toku_loader {
int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */ int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */
int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */ int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */
int (*close)(DB_LOADER *loader); /* finish loading, free memory */ int (*close)(DB_LOADER *loader); /* finish loading, free memory */
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
}; };
typedef struct __toku_engine_status { typedef struct __toku_engine_status {
char now[26]; /* time of engine status query (i.e. now) */ char now[26]; /* time of engine status query (i.e. now) */
......
BUILDHEADER_NUMBERED_VERSIONS = 4_6 4_5 4_4 4_3 4_1
BUILDHEADER_CPPFLAGS = -Ibuildheader -Itoku_include
BUILDHEADER_BDBDIR = ../../berkeleydb
BUILDHEADER_MAKE_H_FILES_EXE = $(patsubst %,buildheader/make_db_h_%,$(BUILDHEADER_NUMBERED_VERSIONS))
BUILDHEADER_MAKE_H_FILES_O = $(patsubst %,%.o,$(BUILDHEADER_MAKE_H_FILES_EXE))
BUILDHEADER_H_FILES = $(patsubst %,buildheader/db.h_%,$(BUILDHEADER_NUMBERED_VERSIONS))
$(BUILDHEADER_MAKE_H_FILES_O): C99=
buildheader/make_db_h_4_1.o: BUILDHEADER_MAJMINDOT=4.1.25
buildheader/make_db_h_4_3.o: BUILDHEADER_MAJMINDOT=4.3.29
buildheader/make_db_h_4_4.o: BUILDHEADER_MAJMINDOT=4.4.20
buildheader/make_db_h_4_5.o: BUILDHEADER_MAJMINDOT=4.5.20
buildheader/make_db_h_4_6.o: BUILDHEADER_MAJMINDOT=4.6.19
buildheader/make_db_h_4_%.o: buildheader/make_db_h.c buildheader/sample_offsets_32_4_1.h buildheader/sample_offsets_64_4_1.h
$(CC) $(CFLAGS) $(BUILDHEADER_CPPFLAGS) -I$(BUILDHEADER_BDBDIR)/db-$(BUILDHEADER_MAJMINDOT)/build_unix $< -c -o $@ -DUSE_MAJOR=4 -DUSE_MINOR=$(patsubst buildheader/make_db_h_4_%.o,%,$@) -DTDB_NATIVE=0
buildheader/make_tdb_h.o: C99=
buildheader/make_tdb_h.o: buildheader/make_db_h.c
$(CC) $(CFLAGS) $(BUILDHEADER_CPPFLAGS) -I$(BUILDHEADER_BDBDIR)/db-4.6.19/build_unix $< -c -o $@ -DUSE_MAJOR=4 -DUSE_MINOR=6 -DTDB_NATIVE=1
$(BUILDHEADER_MAKE_H_FILES_EXE):
buildheader/make_db_h_%: buildheader/make_db_h_%.o
buildheader/db.h_%: buildheader/make_db_h_%
./$< > $@
sample_offsets_4_1: sample_offsets.c
$(CC) $(CFLAGS) $(CPPFLAGS) -I$(BDBDIR)/db-4.1.25/build_unix $< -o $@
./sample_offsets_4_1
sample_offsets_4_3: sample_offsets.c
$(CC) $(CFLAGS) $(CPPFLAGS) -I$(BDBDIR)/db-4.3.29/build_unix $< -o $@
./sample_offsets_4_3
sample_offsets_4_4: sample_offsets.c
$(CC) $(CFLAGS) $(CPPFLAGS) -I$(BDBDIR)/db-4.4.20/build_unix $< -o $@
./sample_offsets_4_4
sample_offsets_4_5: sample_offsets.c
$(CC) $(CFLAGS) $(CPPFLAGS) -I$(BDBDIR)/db-4.5.20/build_unix $< -o $@
./sample_offsets_4_5
sample_offsets_4_6: sample_offsets.c
$(CC) $(CFLAGS) $(CPPFLAGS) -I$(BDBDIR)/db-4.6.19/build_unix $< -o $@
./sample_offsets_4_6
buildheader/tdb.h: buildheader/make_tdb_h
./$< > $@
buildheader/build: include/db.h $(BUILDHEADER_H_FILES)
include/db.h: buildheader/tdb.h
cp $< $@
...@@ -384,6 +384,7 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un ...@@ -384,6 +384,7 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un
printf(" int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */\n"); printf(" int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */\n");
printf(" int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */\n"); printf(" int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */\n");
printf(" int (*close)(DB_LOADER *loader); /* finish loading, free memory */\n"); printf(" int (*close)(DB_LOADER *loader); /* finish loading, free memory */\n");
printf(" int (*abort)(DB_LOADER *loader); /* abort loading, free memory */\n");
printf("};\n"); printf("};\n");
//engine status info //engine status info
......
...@@ -54,6 +54,7 @@ struct __toku_loader { ...@@ -54,6 +54,7 @@ struct __toku_loader {
int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */ int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */
int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */ int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */
int (*close)(DB_LOADER *loader); /* finish loading, free memory */ int (*close)(DB_LOADER *loader); /* finish loading, free memory */
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
}; };
typedef struct __toku_engine_status { typedef struct __toku_engine_status {
char now[26]; /* time of engine status query (i.e. now) */ char now[26]; /* time of engine status query (i.e. now) */
......
...@@ -54,6 +54,7 @@ struct __toku_loader { ...@@ -54,6 +54,7 @@ struct __toku_loader {
int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */ int (*set_poll_function)(DB_LOADER *loader, int (*poll_func)(void *extra, float progress)); /* set the polling function */
int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */ int (*put)(DB_LOADER *loader, DBT *key, DBT* val); /* give a row to the loader */
int (*close)(DB_LOADER *loader); /* finish loading, free memory */ int (*close)(DB_LOADER *loader); /* finish loading, free memory */
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
}; };
typedef struct __toku_engine_status { typedef struct __toku_engine_status {
char now[26]; /* time of engine status query (i.e. now) */ char now[26]; /* time of engine status query (i.e. now) */
......
include linux/tests/make.include
LIBPORTABILITY = lib/libtokuportability.$(AEXT)
linux/build: $(LIBPORTABILITY)
LINUX_SRCS = $(wildcard linux/*.c)
LINUX_OBJS = $(patsubst %.c,%.$(OEXT),$(LINUX_SRCS))
$(LINUX_OBJS): CFLAGS += -DTOKU_ALLOW_DEPRECATED -D_GNU_SOURCE
$(LIBPORTABILITY): $(LINUX_OBJS)
linux/check: linux/tests/check
LINUX_TESTS_SRCS = $(wildcard linux/tests/test-*.c)
LINUX_TESTS_TARGETS = $(patsubst %.c,%,$(LINUX_TESTS_SRCS))
LINUX_TESTS_RUNTARGETS = $(patsubst %,%.tdbrun,$(LINUX_TESTS_TARGETS))
linux/tests/build: $(LINUX_TESTS_TARGETS)
linux/tests/check: $(LINUX_TESTS_RUNTARGETS)
linux/tests/%: CPPFLAGS = -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -Itoku_include -Ilinux -Ilinux/tests
linux/tests/%: CFLAGS = -Wall -Werror -g -O0 -std=c99 $(CC_VERSION_SPECIFIC_FLAGS)
linux/tests/%: LOADLIBES = lib/libtokuportability.a -lpthread
linux/tests/%.tdbrun: linux/tests/%
$(VGRIND) ./$< $(SUMMARIZE_CMD)
linux/tests/test-gettime: LOADLIBES += -lrt
linux/tests/foo:
echo $(VGRIND)
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>
void test_stat(char *dirname, int result, int ex_errno) { static void test_stat(char *dirname, int result, int ex_errno) {
int r; int r;
toku_struct_stat buf; toku_struct_stat buf;
r = toku_stat(dirname, &buf); r = toku_stat(dirname, &buf);
......
SYSTEM = $(shell uname -s | tr [:upper:] [:lower:])
ARCH = $(shell uname -m | tr [:upper:] [:lower:])
ifeq ($(CYGWIN),)
OS=$(SYSTEM)
else ifneq ($(CC),icc)
OS=$(SYSTEM)
else
OS=windows
endif
ifeq ($(CC),icc)
COMPILER=icc
else
COMPILER=gcc
endif
OEXT_linux_gcc =o
OEXT_windows_icc=obj
OEXT=$(OEXT_$(OS)_$(COMPILER))
AEXT_linux_gcc =a
AEXT_windows_icc=lib
AEXT=$(AEXT_$(OS)_$(COMPILER))
COMBINE_C_windows_icc = -Qipo-c
COMBINE_C_linux_icc = -ipo-c
COMBINE_C_linux_gcc = -combine -c
COMBINE_C = $(COMBINE_C_$(OS)_$(COMPILER))
# Need XOPEN_SOURCE=600 to get strtoll()
ifeq ($(SYSTEM),linux)
CPPFLAGS+=-D_SVID_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600
endif
ifeq ($(SYSTEM),sunos)
CPPFLAGS+=-D_SVID_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600
endif
WALL = -Wall -Wextra -Wcast-align -Wbad-function-cast -Wno-missing-noreturn -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
W64 =
ifeq ($(CC),icc)
W64 = -Wport #-Wp64
endif
ifeq ($(SYSTEM),freebsd)
WERROR =
else
WERROR = -Werror
endif
ifneq ($(CYGWIN),)
ifeq ($(CC),icc)
#Cygwin icc only
WERROR = -WX # Windows icc version of -Werror
WERROR += -Qdiag-error:167,266,810 # Workarounds for -WX not being complete on windows icc
endif
endif
FORMAT = -Wmissing-format-attribute #-Wformat=2 #Stronger printf warnings once logger.c cleaned up
ifeq ($(CC),icc)
FORMAT= #No argument for extra format warnings.
endif
ifneq ($(CYGWIN),)
ifneq ($(CC),icc)
FORMAT = -Wno-format # cygwin gcc only
endif
endif
ifeq ($(SYSTEM),sunos)
VISIBILITY=
else
VISIBILITY= -fvisibility=hidden
endif
ifneq ($(CYGWIN),)
VISIBILITY=#Not supported
endif
FPICFLAGS = -fPIC
ifneq ($(CYGWIN),)
FPICFLAGS=#FPIC is default and not allowed as an option.
endif
SHADOW = -Wshadow
ifneq ($(CYGWIN),)
SHADOW=#Not supported
endif
ifneq ($(CC),icc)
ifeq ($(ARCH),i686)
ARCHFLAGS = -march=$(ARCH)
endif
endif
ifeq ($(CC),icc)
#icc only:
OPT_OPTFLAGS = -O3 -ip -ipo1
DBG_OPTFLAGS = -O0
else
ifneq ($(CYGWIN),)
#cygwin icc
OPT_OPTFLAGS = -Ox -Qip -Qipo1
DBG_OPTFLAGS = -Od
else
#linux icc
OPT_OPTFLAGS = -O3 -finline-functions
DBG_OPTFLAGS = -O0
endif
endif
AR=ar
DBG_ARFLAGS=cr
OPT_ARFLAGS=cr
foo:
echo $(DEBUG)
ifneq ($(DEBUG),1)
OPTFLAGS = $(OPT_OPTFLAGS)
ARFLAGS = $(OPT_ARFLAGS)
else
OPTFLAGS = $(DBG_OPTFLAGS)
ARFLAGS = $(DBG_ARFLAGS)
endif
ifneq ($(GCOV),)
GCOV_FLAGS = -fprofile-arcs -ftest-coverage -DGCOV
endif
ifneq ($(PROF),)
PROF_FLAGS = -pg
endif
ifeq ($(CC),icc)
SYMBOLS= -g -debug all -inline-debug-info
else
ifneq ($(CYGWIN),)
SYMBOLS= -Zi -debug:all -Qinline-debug-info
else
SYMBOLS = -g3 -ggdb3
endif
endif
SKIP_WARNING=
ifeq ($(CC),icc)
ifneq ($(CYGWIN),)
#Cygwin
ICC_NOWARN=-Qdiag-disable:
SKIP_WARNING += $(ICC_NOWARN)869 # Don't complain about unused variables (since we defined __attribute__ to be nothing.)
SKIP_WARNING += $(ICC_NOWARN)593 # Don't complain about unused variables (since we defined __attribute__ to be nothing.)
SKIP_WARNING += $(ICC_NOWARN)11000 # Disable message about multi-file optimization
SKIP_WARNING += $(ICC_NOWARN)11000 # Disable message about single-file optimization
SKIP_WARNING += $(ICC_NOWARN)11005 # Disable message about creating object file
SKIP_WARNING += $(ICC_NOWARN)188 # Disable message about 0 used for enum
SKIP_WARNING += $(ICC_NOWARN)1011 # Disable message about missing return with an abort
else
#Linux
ICC_NOWARN=-diag-disable #Need the space
endif
SKIP_WARNING += $(ICC_NOWARN)810 # Remove warnings about losing precision
SKIP_WARNING += $(ICC_NOWARN)94 # Allow arrays of length 0
SKIP_WARNING += $(ICC_NOWARN)118 # Allow void functions to return void functions
SKIP_WARNING += $(ICC_NOWARN)177 # Don't complain about static variables that are not used.
#SKIP_WARNING += $(ICC_NOWARN)188 # Don't complain about enumerated type mixed with another type.
SKIP_WARNING += $(ICC_NOWARN)589 # Don't complain about goto into a block that skips initializing variables. GCC catches the actual uninitialized variables.
SKIP_WARNING += $(ICC_NOWARN)981 # Don't complain about "operands are evaluated in unspecified order". This seems to be generated whenever more than one argument to a function or operand is computed by function call.
SKIP_WARNING += $(ICC_NOWARN)1324 # Don't complain about rdtsc clobbering its registers more than once.
endif
C99 = -std=c99
ifneq ($(CYGWIN),)
ifeq ($(CC),icc)
C99 = -Qstd=c99 -Qvc9
endif
endif
CCQUIET=
ifneq ($(CYGWIN),)
ifeq ($(CC),icc)
CCQUIET=-nologo
endif
endif
ifeq ($(GCCVERSION),4.4.2)
CC_VERSION_SPECIFIC_FLAGS = -Wno-deprecated
endif
CFLAGS = $(WALL) $(W64) $(WERROR) $(FORMAT) $(VISIBILITY) $(FPICFLAGS) $(SHADOW) $(ARCHFLAGS) \
$(OPTFLAGS) $(GCOV_FLAGS) $(PROF_FLAGS) \
$(SYMBOLS) $(SKIP_WARNING) $(C99) $(CCQUIET) $(CC_VERSION_SPECIFIC_FLAGS)
OOUTPUT = -o
ifneq ($(CYGWIN),)
ifeq ($(CC),icc)
OOUTPUT=-Fo
endif
endif
# TODO: 1398 Get rid of this hack.
CPPFLAGS+=-DBRT_LEVEL_STRADDLE_CALLBACK_LOGIC_NOT_READY=1
CPPFLAGS+=-Itoku_include -I$(OS)
ifeq ($(TOKU_SKIP_CXX),1)
SRCDIRS_CXX =
else
SRCDIRS_CXX = cxx db-benchmark-test-cxx
endif
//SRCDIRS = $(OS) newbrt src utils db-benchmark-test $(SRCDIRS_CXX)
SRCDIRS = $(OS) buildheader newbrt
%.$(OEXT):%.c
$(CC) $< -c $(CPPFLAGS) $(CFLAGS) $(OOUTPUT)$@
%.$(AEXT):
$(AR) $(ARFLAGS) $(AROUTPUT)$@ $(filter %.$(OEXT),$^) $(patsubst %.bundle, %.bundle/*.$(OEXT), $(filter-out %.$(OEXT),$^))
VALGRIND=valgrind
SUPPRESSIONS=no
VGRIND=$(VALGRIND) --quiet --error-exitcode=1 --leak-check=full --show-reachable=yes \
--suppressions=$(TOKUROOT)newbrt/valgrind.suppressions \
--suppressions=$(TOKUROOT)src/tests/bdb.suppressions \
--gen-suppressions=$(SUPPRESSIONS)
#Testing tools
ifeq ($(SUMMARIZE),1)
SUMMARIZE_CMD = ;if test $$? = 0; then printf "%-60sPASS\n" $(HERE)/$@; else printf "%-60sFAIL\n" $(HERE)/$@ ; test 0 = 1; fi
SUMMARIZE_SHOULD_FAIL= ;if test $$? = 0; then printf "%-60sXFAIL\n" $(HERE)/$@; else printf "%-60sXPASS\n" $(HERE)/$@ ; test 0 = 1; fi
INVERTER=;test $$? -ne 0
else
SUMMARIZE_CMD =
endif
include $(patsubst %,%/make.include,$(SRCDIRS))
build: buildheader/build $(OS)/build
check: $(OS)/check
...@@ -82,7 +82,6 @@ BRT_O_FILES = $(patsubst %,%.$(OEXT),$(BRT_SOURCES)) ...@@ -82,7 +82,6 @@ BRT_O_FILES = $(patsubst %,%.$(OEXT),$(BRT_SOURCES))
newbrt.$(OEXT): $(BRT_C_FILES) $(DEPEND_COMPILE) newbrt.$(OEXT): $(BRT_C_FILES) $(DEPEND_COMPILE)
$(CC) -c $(BRT_C_FILES) $(COMBINE_C) $(CPPFLAGS) $(CFLAGS) $(OOUTPUT)$@ $(CC) -c $(BRT_C_FILES) $(COMBINE_C) $(CPPFLAGS) $(CFLAGS) $(OOUTPUT)$@
ifneq ($(CYGWIN),) ifneq ($(CYGWIN),)
NEWBRT_O_FILES = $(BRT_O_FILES) NEWBRT_O_FILES = $(BRT_O_FILES)
else ifeq ($(CC),icc) else ifeq ($(CC),icc)
...@@ -112,7 +111,7 @@ log_code.$(OEXT): log_header.h wbuf.h log-internal.h rbuf.h ...@@ -112,7 +111,7 @@ log_code.$(OEXT): log_header.h wbuf.h log-internal.h rbuf.h
## ./logformat ## ./logformat
# So we do it this way # So we do it this way
log_code.c: logformat$(BINSUF) log_code.c: logformat$(BINSUF)
./logformat ./logformat .
log_print.c log_header.h: log_code.c log_print.c log_header.h: log_code.c
test 1 = 1 test 1 = 1
......
...@@ -614,10 +614,21 @@ generate_log_entry_functions(void) { ...@@ -614,10 +614,21 @@ generate_log_entry_functions(void) {
fprintf(cf, "}\n"); fprintf(cf, "}\n");
} }
const char *codepath = "log_code.c"; const char codefile[] = "log_code.c";
const char *printpath = "log_print.c"; const char printfile[] = "log_print.c";
const char *headerpath = "log_header.h"; const char headerfile[] = "log_header.h";
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int main (int argc, const char *argv[]) {
assert(argc==2); // the single argument is the directory into which to put things
const char *dir = argv[1];
size_t codepathlen = sizeof(codefile) + strlen(dir) + 4;
size_t printpathlen = sizeof(printfile) + strlen(dir) + 4;
size_t headerpathlen = sizeof(headerfile) + strlen(dir) + 4;
char codepath[codepathlen];
char printpath[printpathlen];
char headerpath[headerpathlen];
{ int r = snprintf(codepath, codepathlen, "%s/%s", argv[1], codefile); assert(r<(int)codepathlen); }
{ int r = snprintf(printpath, printpathlen, "%s/%s", argv[1], printfile); assert(r<(int)printpathlen); }
{ int r = snprintf(headerpath, headerpathlen, "%s/%s", argv[1], headerfile); assert(r<(int)headerpathlen); }
chmod(codepath, S_IRUSR|S_IWUSR); chmod(codepath, S_IRUSR|S_IWUSR);
chmod(headerpath, S_IRUSR|S_IWUSR); chmod(headerpath, S_IRUSR|S_IWUSR);
unlink(codepath); unlink(codepath);
......
NEWBRT_BINS = $(patsubst %,newbrt/%$(BINSUF),$(BINS_RAW))
TEST_NEWBRT = newbrt/brt-test-helpers.$(OEXT)
# This version runs logformat twice. There is something screwing in make that if you have a pattern form with two outputs
# then it runs the thing only once, but if it has no % symbols it runs it twice.
## log_header.h log_code.c: logformat$(BINSUF)
## ./logformat
# So we do it this way
newbrt/log_print.c newbrt/log_header.h newbrt/log_code.c: newbrt/logformat$(BINSUF)
newbrt/logformat$(BINSUF) newbrt
.PRECIOUS: newbrt/log_print.c newbrt/log_header.h newbrt/log_code.c
NEWBRT_A = newbrt/newbrt.$(AEXT)
BRT_SOURCES = \
block_allocator \
block_table \
bread \
brt-serialize \
brt-verify \
brt \
brt_msg \
brt-test-helpers \
cachetable \
checkpoint \
fifo \
fingerprint \
key \
leafentry \
leaflock \
logfilemgr \
logger \
log_code \
log_print \
logcursor \
memarena \
mempool \
minicron \
omt \
recover \
roll \
rollback \
ule \
threadpool \
toku_worker \
trace_mem \
txn \
x1764 \
xids \
ybt \
# keep this line so I can have a \ on the previous line
BRT_C_FILES = $(patsubst %,newbrt/%.c,$(BRT_SOURCES))
BRT_O_FILES = $(patsubst %,newbrt/%.$(OEXT),$(BRT_SOURCES))
$(TEST_NEWBRT): newbrt/log_header.h
$(TEST_NEWBRT) $(BRT_O_FILES) newbrt/newbrt.$(OEXT): CPPFLAGS += -Inewbrt -Iinclude
newbrt/newbrt.$(OEXT): $(BRT_C_FILES) $(DEPEND_COMPILE)
$(CC) -c $(BRT_C_FILES) $(COMBINE_C) $(CPPFLAGS) $(CFLAGS) $(OOUTPUT)$@
ifneq ($(CYGWIN),)
NEWBRT_O_FILES = $(BRT_O_FILES)
else ifeq ($(CC),icc)
NEWBRT_O_FILES = $(BRT_O_FILES)
else ifeq ($(COMBINE),0)
NEWBRT_O_FILES = $(BRT_O_FILES)
else
NEWBRT_O_FILES = newbrt/newbrt.o
endif
$(NEWBRT_A): $(NEWBRT_O_FILES)
newbrt/build: newbrt/bins newbrt/libs $(TEST_NEWBRT)
newbrt/bins: $(NEWBRT_BINS)
newbrt/libs: $(NEWBRT_A)
.PHONY: newbrt/build newbrt/bins newbrt/libs
...@@ -71,6 +71,7 @@ int toku_loader_create_loader(DB_ENV *env, ...@@ -71,6 +71,7 @@ int toku_loader_create_loader(DB_ENV *env,
loader->set_duplicate_callback = toku_loader_set_duplicate_callback; loader->set_duplicate_callback = toku_loader_set_duplicate_callback;
loader->put = toku_loader_put; loader->put = toku_loader_put;
loader->close = toku_loader_close; loader->close = toku_loader_close;
loader->abort = toku_loader_abort;
*blp = loader; *blp = loader;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
int test_main(int argc, char *argv[]) { int test_main(int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) {
int r; int r;
toku_pthread_rwlock_t rwlock; toku_pthread_rwlock_t rwlock;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
void *f(void *arg) { static void *f(void *arg) {
int r; int r;
toku_pthread_rwlock_t *mylock = arg; toku_pthread_rwlock_t *mylock = arg;
printf("%s:%d\n", __FUNCTION__, __LINE__); fflush(stdout); printf("%s:%d\n", __FUNCTION__, __LINE__); fflush(stdout);
...@@ -15,7 +15,7 @@ void *f(void *arg) { ...@@ -15,7 +15,7 @@ void *f(void *arg) {
return arg; return arg;
} }
int test_main(int argc, char *argv[]) { int test_main(int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) {
int r; int r;
toku_pthread_rwlock_t rwlock; toku_pthread_rwlock_t rwlock;
toku_pthread_t tid; toku_pthread_t tid;
......
...@@ -12,7 +12,7 @@ static int iszero(char *cp, size_t n) { ...@@ -12,7 +12,7 @@ static int iszero(char *cp, size_t n) {
return 1; return 1;
} }
int test_main(int argc, char *argv[]) { int test_main(int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) {
char fname[] = "pwrite4g.data"; char fname[] = "pwrite4g.data";
int r; int r;
unlink(fname); unlink(fname);
......
...@@ -23,20 +23,20 @@ check_snprintf(int i) { ...@@ -23,20 +23,20 @@ check_snprintf(int i) {
int bytes = snprintf(target, sizeof target, "%"PRId64, n); int bytes = snprintf(target, sizeof target, "%"PRId64, n);
assert(bytes==i+1 || assert(bytes==i+1 ||
(i+1>=sizeof target && bytes>=sizeof target)); (i+1>=(int)(sizeof target) && bytes>=(int)(sizeof target)));
if (bytes>=sizeof target) { if (bytes>=(int)(sizeof target)) {
//Overflow prevented by snprintf //Overflow prevented by snprintf
assert(target[sizeof target - 1] == '\0'); assert(target[sizeof target - 1] == '\0');
assert(strlen(target)==sizeof target-1); assert(strlen(target)==sizeof target-1);
} }
else { else {
assert(target[bytes] == '\0'); assert(target[bytes] == '\0');
assert(strlen(target)==bytes); assert(strlen(target)==(size_t)bytes);
} }
} }
int test_main(int argc, char *argv[]) { int test_main(int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) {
int i; int i;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
check_snprintf(i); check_snprintf(i);
......
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