[t:4871] cast pthread_t through void * to avoid -Wbad-function-cast on osx, fix toku_time.h on osx too (include errno.h)

git-svn-id: file:///svn/toku/tokudb@43884 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
Leif Walsh 2013-04-17 00:00:36 -04:00 committed by Yoni Fogel
parent 966eea0f44
commit 95ed2a0eb6
14 changed files with 29 additions and 28 deletions

View file

@ -18,6 +18,7 @@ static inline float toku_tdiff (struct timeval *a, struct timeval *b) {
} }
#if !defined(HAVE_CLOCK_REALTIME) // OS X does not have clock_gettime, use clock_get_time #if !defined(HAVE_CLOCK_REALTIME) // OS X does not have clock_gettime, use clock_get_time
# include <errno.h>
# include <mach/clock.h> # include <mach/clock.h>
# include <mach/mach.h> # include <mach/mach.h>
typedef int clockid_t; typedef int clockid_t;

View file

@ -53,7 +53,7 @@ static void blocking_first(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptim
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == 0);
if (verbose) if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i); printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
} }
toku_free(context.key.data); toku_free(context.key.data);

View file

@ -70,7 +70,7 @@ static void blocking_first(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptim
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == 0);
if (verbose) if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i); printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
} }
toku_free(context.key.data); toku_free(context.key.data);

View file

@ -70,7 +70,7 @@ static void blocking_last(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == 0);
if (verbose) if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i); printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
} }
toku_free(context.key.data); toku_free(context.key.data);

View file

@ -77,21 +77,21 @@ static void blocking_next(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee
if (r != 0) if (r != 0)
break; break;
if (verbose) if (verbose)
printf("%lu next %"PRIu64"\n", (unsigned long) toku_pthread_self(), get_key(&context.key)); printf("%lu next %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), get_key(&context.key));
usleep(sleeptime); usleep(sleeptime);
} }
if (verbose) if (verbose)
printf("%lu next=%d\n", (unsigned long) toku_pthread_self(), r); printf("%lu next=%d\n", (unsigned long)(void *) toku_pthread_self(), r);
assert(r == DB_NOTFOUND || r == DB_LOCK_DEADLOCK); assert(r == DB_NOTFOUND || r == DB_LOCK_DEADLOCK);
int rr = cursor->c_close(cursor); assert(rr == 0); int rr = cursor->c_close(cursor); assert(rr == 0);
if (r == DB_NOTFOUND) { if (r == DB_NOTFOUND) {
if (verbose) printf("%lu commit\n", (unsigned long) toku_pthread_self()); if (verbose) printf("%lu commit\n", (unsigned long)(void *) toku_pthread_self());
r = txn->commit(txn, 0); r = txn->commit(txn, 0);
} else { } else {
if (verbose) printf("%lu abort\n", (unsigned long) toku_pthread_self()); if (verbose) printf("%lu abort\n", (unsigned long)(void *) toku_pthread_self());
r = txn->abort(txn); r = txn->abort(txn);
} }
assert(r == 0); assert(r == 0);
@ -123,21 +123,21 @@ static void blocking_prev(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee
if (r != 0) if (r != 0)
break; break;
if (verbose) if (verbose)
printf("%lu prev %"PRIu64"\n", (unsigned long) toku_pthread_self(), get_key(&context.key)); printf("%lu prev %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), get_key(&context.key));
usleep(sleeptime); usleep(sleeptime);
} }
if (verbose) if (verbose)
printf("%lu prev=%d\n", (unsigned long) toku_pthread_self(), r); printf("%lu prev=%d\n", (unsigned long)(void *) toku_pthread_self(), r);
assert(r == DB_NOTFOUND || r == DB_LOCK_DEADLOCK); assert(r == DB_NOTFOUND || r == DB_LOCK_DEADLOCK);
int rr = cursor->c_close(cursor); assert(rr == 0); int rr = cursor->c_close(cursor); assert(rr == 0);
if (r == DB_NOTFOUND) { if (r == DB_NOTFOUND) {
if (verbose) printf("%lu commit\n", (unsigned long) toku_pthread_self()); if (verbose) printf("%lu commit\n", (unsigned long)(void *) toku_pthread_self());
r = txn->commit(txn, 0); r = txn->commit(txn, 0);
} else { } else {
if (verbose) printf("%lu abort\n", (unsigned long) toku_pthread_self()); if (verbose) printf("%lu abort\n", (unsigned long)(void *) toku_pthread_self());
r = txn->abort(txn); r = txn->abort(txn);
} }
assert(r == 0); assert(r == 0);

View file

@ -76,21 +76,21 @@ static void blocking_next(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee
if (r != 0) if (r != 0)
break; break;
if (verbose) if (verbose)
printf("%lu next %"PRIu64"\n", (unsigned long) toku_pthread_self(), get_key(&context.key)); printf("%lu next %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), get_key(&context.key));
usleep(sleeptime); usleep(sleeptime);
} }
if (verbose) if (verbose)
printf("%lu next=%d\n", (unsigned long) toku_pthread_self(), r); printf("%lu next=%d\n", (unsigned long)(void *) toku_pthread_self(), r);
assert(r == DB_NOTFOUND || r == DB_LOCK_DEADLOCK); assert(r == DB_NOTFOUND || r == DB_LOCK_DEADLOCK);
int rr = cursor->c_close(cursor); assert(rr == 0); int rr = cursor->c_close(cursor); assert(rr == 0);
if (r == DB_NOTFOUND) { if (r == DB_NOTFOUND) {
if (verbose) printf("%lu commit\n", (unsigned long) toku_pthread_self()); if (verbose) printf("%lu commit\n", (unsigned long)(void *) toku_pthread_self());
r = txn->commit(txn, 0); r = txn->commit(txn, 0);
} else { } else {
if (verbose) printf("%lu abort\n", (unsigned long) toku_pthread_self()); if (verbose) printf("%lu abort\n", (unsigned long)(void *) toku_pthread_self());
r = txn->abort(txn); r = txn->abort(txn);
} }
assert(r == 0); assert(r == 0);
@ -122,21 +122,21 @@ static void blocking_prev(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee
if (r != 0) if (r != 0)
break; break;
if (verbose) if (verbose)
printf("%lu prev %"PRIu64"\n", (unsigned long) toku_pthread_self(), get_key(&context.key)); printf("%lu prev %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), get_key(&context.key));
usleep(sleeptime); usleep(sleeptime);
} }
if (verbose) if (verbose)
printf("%lu prev=%d\n", (unsigned long) toku_pthread_self(), r); printf("%lu prev=%d\n", (unsigned long)(void *) toku_pthread_self(), r);
assert(r == DB_NOTFOUND); assert(r == DB_NOTFOUND);
int rr = cursor->c_close(cursor); assert(rr == 0); int rr = cursor->c_close(cursor); assert(rr == 0);
if (r == DB_NOTFOUND) { if (r == DB_NOTFOUND) {
if (verbose) printf("%lu commit\n", (unsigned long) toku_pthread_self()); if (verbose) printf("%lu commit\n", (unsigned long)(void *) toku_pthread_self());
r = txn->commit(txn, 0); r = txn->commit(txn, 0);
} else { } else {
if (verbose) printf("%lu abort\n", (unsigned long) toku_pthread_self()); if (verbose) printf("%lu abort\n", (unsigned long)(void *) toku_pthread_self());
r = txn->abort(txn); r = txn->abort(txn);
} }
assert(r == 0); assert(r == 0);

View file

@ -25,7 +25,7 @@ static void blocking_range_lock(DB_ENV *db_env, DB *db, uint64_t nrows, long sle
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == 0);
if (verbose) if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i); printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
} }
} }

View file

@ -24,7 +24,7 @@ static void blocking_put(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime)
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == 0);
if (verbose) if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i); printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
} }
} }

View file

@ -79,7 +79,7 @@ static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long slee
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == 0);
if (verbose) if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i); printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
} }
toku_free(context.key.data); toku_free(context.key.data);

View file

@ -74,7 +74,7 @@ static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long slee
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == 0);
if (verbose) if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i); printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
} }
toku_free(context.key.data); toku_free(context.key.data);

View file

@ -77,7 +77,7 @@ static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long slee
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == 0);
if (verbose) if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i); printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
} }
toku_free(context.key.data); toku_free(context.key.data);

View file

@ -67,7 +67,7 @@ static void blocking_set(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime)
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == 0);
if (verbose) if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i); printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
} }
toku_free(val.data); toku_free(val.data);

View file

@ -18,7 +18,7 @@ static void blocking_table_lock(DB_ENV *db_env, DB *db, uint64_t nrows, long sle
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == 0);
if (verbose) if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i); printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
} }
} }

View file

@ -203,7 +203,7 @@ static void *worker(void *arg_v) {
DB_ENV *env = arg->env; DB_ENV *env = arg->env;
DB_TXN *txn = NULL; DB_TXN *txn = NULL;
if (verbose) { if (verbose) {
printf("%lu starting %p\n", (unsigned long) toku_pthread_self(), arg->operation); printf("%lu starting %p\n", (unsigned long)(void *) toku_pthread_self(), arg->operation);
} }
if (arg->single_txn) { if (arg->single_txn) {
r = env->txn_begin(env, 0, &txn, arg->txn_type); CKERR(r); r = env->txn_begin(env, 0, &txn, arg->txn_type); CKERR(r);
@ -237,7 +237,7 @@ static void *worker(void *arg_v) {
CHK(txn->commit(txn, 0)); CHK(txn->commit(txn, 0));
} }
if (verbose) if (verbose)
printf("%lu returning\n", (unsigned long) toku_pthread_self()); printf("%lu returning\n", (unsigned long)(void *) toku_pthread_self());
toku_free(random_buf); toku_free(random_buf);
return arg; return arg;
} }