Commit 89ace771 authored by Yoni Fogel's avatar Yoni Fogel

Addresses #1032

Replaced windows portability functions with better (native) windows calls

git-svn-id: file:///svn/toku/tokudb.1032b@8297 c7de825b-a66e-492c-adef-691d508d4ae1
parent c6011076
...@@ -37,19 +37,7 @@ fsync(int fd) { ...@@ -37,19 +37,7 @@ fsync(int fd) {
int int
ftruncate(int fd, int64_t offset) { ftruncate(int fd, int64_t offset) {
HANDLE h; int r = _chsize_s(fd, offset);
BOOL b; return r;
int r;
h = (HANDLE) _get_osfhandle(fd);
if (h == INVALID_HANDLE_VALUE)
return -1;
r = _lseeki64(fd, 0, SEEK_SET);
if (r != 0)
return -2;
b = SetEndOfFile(h);
if (!b)
return -3;
return 0;
} }
...@@ -22,11 +22,13 @@ ...@@ -22,11 +22,13 @@
int int
toku_os_get_file_size(int fildes, int64_t *size) { toku_os_get_file_size(int fildes, int64_t *sizep) {
struct _stat64 sbuf; int r;
int r = _fstati64(fildes, &sbuf); int64_t size = _filelengthi64(fildes);
if (r==0) { if (size<0) r = errno;
*size = sbuf.st_size; else {
r = 0;
*sizep = size;
} }
return r; return r;
} }
......
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