From ab76ea5007be8bed6f3e3156a084c2cafa2f7e63 Mon Sep 17 00:00:00 2001 From: Yoni Fogel Date: Tue, 16 Apr 2013 23:57:39 -0400 Subject: [PATCH] Fix windows build git-svn-id: file:///svn/toku/tokudb@9112 c7de825b-a66e-492c-adef-691d508d4ae1 --- windows/files.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/windows/files.c b/windows/files.c index 5837116064b..796807c7c0f 100644 --- a/windows/files.c +++ b/windows/files.c @@ -72,3 +72,27 @@ ftruncate(int fd, int64_t offset) { return r; } +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)) { + t_pwrite = pwrite_fun; + return 0; +} + +int toku_set_func_write (ssize_t (*write_fun)(int, const void *, size_t)) { + t_write = write_fun; + return 0; +} + + +ssize_t +toku_os_pwrite (int fd, const void *buf, size_t len, off_t off) +{ + if (t_pwrite) { + return t_pwrite(fd, buf, len, off); + } else { + return pwrite(fd, buf, len, off); + } +} +