Commit 19165401 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 83a90095
......@@ -37,19 +37,7 @@ fsync(int fd) {
int
ftruncate(int fd, int64_t offset) {
HANDLE h;
BOOL b;
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;
int r = _chsize_s(fd, offset);
return r;
}
......@@ -22,11 +22,13 @@
int
toku_os_get_file_size(int fildes, int64_t *size) {
struct _stat64 sbuf;
int r = _fstati64(fildes, &sbuf);
if (r==0) {
*size = sbuf.st_size;
toku_os_get_file_size(int fildes, int64_t *sizep) {
int r;
int64_t size = _filelengthi64(fildes);
if (size<0) r = errno;
else {
r = 0;
*sizep = size;
}
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