Commit d1a9e7d4 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

compile with linux icc

git-svn-id: file:///svn/toku/tokudb@9537 c7de825b-a66e-492c-adef-691d508d4ae1
parent 34540ce6
#include <toku_portability.h>
#include <unistd.h> #include <unistd.h>
static ssize_t (*t_pwrite)(int, const void *, size_t, off_t) = 0; static ssize_t (*t_pwrite)(int, const void *, size_t, off_t) = 0;
static ssize_t (*t_write)(int, const void *, size_t) = 0;
int toku_set_func_pwrite (ssize_t (*pwrite_fun)(int, const void *, size_t, off_t)) { int
toku_set_func_pwrite (ssize_t (*pwrite_fun)(int, const void *, size_t, off_t)) {
t_pwrite = pwrite_fun; t_pwrite = pwrite_fun;
return 0; return 0;
} }
int toku_set_func_write (ssize_t (*write_fun)(int, const void *, size_t)) {
t_write = write_fun;
return 0;
}
ssize_t ssize_t
toku_os_pwrite (int fd, const void *buf, size_t len, off_t off) toku_os_pwrite (int fd, const void *buf, size_t len, off_t off)
{ {
...@@ -23,3 +18,18 @@ toku_os_pwrite (int fd, const void *buf, size_t len, off_t off) ...@@ -23,3 +18,18 @@ toku_os_pwrite (int fd, const void *buf, size_t len, off_t off)
return pwrite(fd, buf, len, off); return pwrite(fd, buf, len, off);
} }
} }
#if 0
static ssize_t (*t_write)(int, const void *, size_t) = 0;
int
toku_set_func_write (ssize_t (*write_fun)(int, const void *, size_t)) {
t_write = write_fun;
return 0;
}
#endif
...@@ -3403,7 +3403,7 @@ brt_search_node (BRT brt, BRTNODE node, brt_search_t *search, BRT_GET_STRADDLE_C ...@@ -3403,7 +3403,7 @@ brt_search_node (BRT brt, BRTNODE node, brt_search_t *search, BRT_GET_STRADDLE_C
static void static void
brt_node_maybe_prefetch(BRT brt, BRTNODE node, int childnum, BRT_CURSOR brtcursor, BOOL *doprefetch) { brt_node_maybe_prefetch(BRT brt, BRTNODE node, int childnum, BRT_CURSOR brtcursor, BOOL *doprefetch) {
if (0) printf("%s:%d node %p height %d child %d of %d %d/%d\n", __FUNCTION__, __LINE__, node, node->height, childnum, node->u.n.n_children, *doprefetch, brt_cursor_prefetching(brtcursor));
// if we want to prefetch in the tree // if we want to prefetch in the tree
// then prefetch the next children if there are any // then prefetch the next children if there are any
if (*doprefetch && brt_cursor_prefetching(brtcursor)) { if (*doprefetch && brt_cursor_prefetching(brtcursor)) {
...@@ -4224,7 +4224,7 @@ toku_brt_cursor_delete(BRT_CURSOR cursor, int flags, TOKUTXN txn) { ...@@ -4224,7 +4224,7 @@ toku_brt_cursor_delete(BRT_CURSOR cursor, int flags, TOKUTXN txn) {
int r; int r;
int unchecked_flags = flags; int unchecked_flags = flags;
BOOL error_if_missing = !(flags&DB_DELETE_ANY); BOOL error_if_missing = (BOOL) !(flags&DB_DELETE_ANY);
unchecked_flags &= ~DB_DELETE_ANY; unchecked_flags &= ~DB_DELETE_ANY;
if (unchecked_flags!=0) r = EINVAL; if (unchecked_flags!=0) r = EINVAL;
else if (brt_cursor_not_set(cursor)) r = EINVAL; else if (brt_cursor_not_set(cursor)) r = EINVAL;
...@@ -4462,12 +4462,12 @@ static BOOL ...@@ -4462,12 +4462,12 @@ static BOOL
brt_is_empty (BRT brt, TOKULOGGER logger) { brt_is_empty (BRT brt, TOKULOGGER logger) {
BRT_CURSOR cursor; BRT_CURSOR cursor;
int r, r2; int r, r2;
int is_empty; BOOL is_empty;
r = toku_brt_cursor(brt, &cursor); r = toku_brt_cursor(brt, &cursor);
if (r == 0) { if (r == 0) {
r = toku_brt_cursor_first(cursor, getf_nothing, NULL, logger); r = toku_brt_cursor_first(cursor, getf_nothing, NULL, logger);
r2 = toku_brt_cursor_close(cursor); r2 = toku_brt_cursor_close(cursor);
is_empty = r2==0 && r==DB_NOTFOUND; is_empty = (BOOL)(r2==0 && r==DB_NOTFOUND);
} }
else is_empty = FALSE; //Declare it "not empty" on error. else is_empty = FALSE; //Declare it "not empty" on error.
return is_empty; return is_empty;
......
...@@ -778,7 +778,7 @@ void toku_cachetable_print_hash_histogram (void) { ...@@ -778,7 +778,7 @@ void toku_cachetable_print_hash_histogram (void) {
for (i=0; i<hash_histogram_max; i++) for (i=0; i<hash_histogram_max; i++)
if (hash_histogram[i]) printf("%d:%llu ", i, hash_histogram[i]); if (hash_histogram[i]) printf("%d:%llu ", i, hash_histogram[i]);
printf("\n"); printf("\n");
printf("miss=%"PRId64" hit=%"PRId64" wait_reading=%"PRId64" wait=%"PRId64"\n", printf("miss=%"PRIu64" hit=%"PRIu64" wait_reading=%"PRIu64" wait=%"PRIu64"\n",
cachetable_miss, cachetable_hit, cachetable_wait_reading, cachetable_wait); cachetable_miss, cachetable_hit, cachetable_wait_reading, cachetable_wait);
} }
...@@ -1471,8 +1471,8 @@ graceful_open_get_append_fd(const char *db_fname, BOOL *was_dirtyp, BOOL *create ...@@ -1471,8 +1471,8 @@ graceful_open_get_append_fd(const char *db_fname, BOOL *was_dirtyp, BOOL *create
graceful_fill_names(db_fname, cleanbuf, sizeof(cleanbuf), dirtybuf, sizeof(dirtybuf)); graceful_fill_names(db_fname, cleanbuf, sizeof(cleanbuf), dirtybuf, sizeof(dirtybuf));
struct stat tmpbuf; struct stat tmpbuf;
clean_exists = stat(cleanbuf, &tmpbuf) == 0; clean_exists = (BOOL)(stat(cleanbuf, &tmpbuf) == 0);
dirty_exists = stat(dirtybuf, &tmpbuf) == 0; dirty_exists = (BOOL)(stat(dirtybuf, &tmpbuf) == 0);
mode_t mode = S_IRWXU|S_IRWXG|S_IRWXO; mode_t mode = S_IRWXU|S_IRWXG|S_IRWXO;
int r = 0; int r = 0;
...@@ -1501,9 +1501,9 @@ graceful_close_get_append_fd(const char *db_fname, BOOL *db_missing) { ...@@ -1501,9 +1501,9 @@ graceful_close_get_append_fd(const char *db_fname, BOOL *db_missing) {
graceful_fill_names(db_fname, cleanbuf, sizeof(cleanbuf), dirtybuf, sizeof(dirtybuf)); graceful_fill_names(db_fname, cleanbuf, sizeof(cleanbuf), dirtybuf, sizeof(dirtybuf));
struct stat tmpbuf; struct stat tmpbuf;
clean_exists = stat(cleanbuf, &tmpbuf) == 0; clean_exists = (BOOL)(stat(cleanbuf, &tmpbuf) == 0);
dirty_exists = stat(dirtybuf, &tmpbuf) == 0; dirty_exists = (BOOL)(stat(dirtybuf, &tmpbuf) == 0);
db_exists = stat(db_fname, &tmpbuf) == 0; db_exists = (BOOL)(stat(db_fname, &tmpbuf) == 0);
mode_t mode = S_IRWXU|S_IRWXG|S_IRWXO; mode_t mode = S_IRWXU|S_IRWXG|S_IRWXO;
int r = 0; int r = 0;
...@@ -1513,7 +1513,7 @@ graceful_close_get_append_fd(const char *db_fname, BOOL *db_missing) { ...@@ -1513,7 +1513,7 @@ graceful_close_get_append_fd(const char *db_fname, BOOL *db_missing) {
} }
if (db_exists) r = open(cleanbuf, O_WRONLY | O_CREAT | O_BINARY | O_APPEND, mode); if (db_exists) r = open(cleanbuf, O_WRONLY | O_CREAT | O_BINARY | O_APPEND, mode);
else if (clean_exists) r = unlink(cleanbuf); else if (clean_exists) r = unlink(cleanbuf);
*db_missing = !db_exists; *db_missing = (BOOL) !db_exists;
return r; return r;
} }
...@@ -1527,8 +1527,8 @@ graceful_dirty_get_append_fd(const char *db_fname) { ...@@ -1527,8 +1527,8 @@ graceful_dirty_get_append_fd(const char *db_fname) {
graceful_fill_names(db_fname, cleanbuf, sizeof(cleanbuf), dirtybuf, sizeof(dirtybuf)); graceful_fill_names(db_fname, cleanbuf, sizeof(cleanbuf), dirtybuf, sizeof(dirtybuf));
struct stat tmpbuf; struct stat tmpbuf;
clean_exists = stat(cleanbuf, &tmpbuf) == 0; clean_exists = (BOOL)(stat(cleanbuf, &tmpbuf) == 0);
dirty_exists = stat(dirtybuf, &tmpbuf) == 0; dirty_exists = (BOOL)(stat(dirtybuf, &tmpbuf) == 0);
mode_t mode = S_IRWXU|S_IRWXG|S_IRWXO; mode_t mode = S_IRWXU|S_IRWXG|S_IRWXO;
int r = 0; int r = 0;
...@@ -1651,8 +1651,8 @@ toku_graceful_delete(const char *db_fname) { ...@@ -1651,8 +1651,8 @@ toku_graceful_delete(const char *db_fname) {
struct stat tmpbuf; struct stat tmpbuf;
lock_for_graceful(); lock_for_graceful();
clean_exists = stat(cleanbuf, &tmpbuf) == 0; clean_exists = (BOOL)(stat(cleanbuf, &tmpbuf) == 0);
dirty_exists = stat(dirtybuf, &tmpbuf) == 0; dirty_exists = (BOOL)(stat(dirtybuf, &tmpbuf) == 0);
int r = 0; int r = 0;
if (clean_exists) { if (clean_exists) {
......
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