#include #include #include #include #include #include #include #include #include #include #include "tdb.h" /* this tests tdb by doing lots of ops from several simultaneous writers - that stresses the locking code. Build with TDB_DEBUG=1 for best effect */ #define DELETE_PROB 7 #define STORE_PROB 5 #define KEYLEN 3 #define DATALEN 100 static TDB_CONTEXT *db; static void tdb_log(TDB_CONTEXT *tdb, int level, const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stdout, format, ap); va_end(ap); } static void fatal(char *why) { perror(why); exit(1); } static char *randbuf(int len) { char *buf; int i; buf = (char *)malloc(len+1); for (i=0;i