Commit 95ed2a0e authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

[t:4871] cast pthread_t through void * to avoid -Wbad-function-cast on osx,...

[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
parent 966eea0f
......@@ -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
# include <errno.h>
# include <mach/clock.h>
# include <mach/mach.h>
typedef int clockid_t;
......
......@@ -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);
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);
......
......@@ -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);
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);
......
......@@ -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);
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);
......
......@@ -77,21 +77,21 @@ static void blocking_next(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee
if (r != 0)
break;
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);
}
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);
int rr = cursor->c_close(cursor); assert(rr == 0);
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);
} 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);
}
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)
break;
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);
}
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);
int rr = cursor->c_close(cursor); assert(rr == 0);
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);
} 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);
}
assert(r == 0);
......
......@@ -76,21 +76,21 @@ static void blocking_next(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee
if (r != 0)
break;
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);
}
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);
int rr = cursor->c_close(cursor); assert(rr == 0);
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);
} 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);
}
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)
break;
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);
}
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);
int rr = cursor->c_close(cursor); assert(rr == 0);
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);
} 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);
}
assert(r == 0);
......
......@@ -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);
if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i);
printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
}
}
......
......@@ -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);
if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i);
printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
}
}
......
......@@ -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);
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);
......
......@@ -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);
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);
......
......@@ -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);
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);
......
......@@ -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);
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);
......
......@@ -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);
if (verbose)
printf("%lu %"PRIu64"\n", (unsigned long) toku_pthread_self(), i);
printf("%lu %"PRIu64"\n", (unsigned long)(void *) toku_pthread_self(), i);
}
}
......
......@@ -203,7 +203,7 @@ static void *worker(void *arg_v) {
DB_ENV *env = arg->env;
DB_TXN *txn = NULL;
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) {
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));
}
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);
return arg;
}
......
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