enh: lock and file adaption for windows
This commit is contained in:
parent
97c87bdbdc
commit
3bb5a5f1d4
|
@ -457,7 +457,6 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset)
|
||||||
}
|
}
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
int64_t ret = 0;
|
int64_t ret = 0;
|
||||||
|
|
||||||
OVERLAPPED ol = {0};
|
OVERLAPPED ol = {0};
|
||||||
ol.OffsetHigh = (uint32_t)((offset & 0xFFFFFFFF00000000LL) >> 0x20);
|
ol.OffsetHigh = (uint32_t)((offset & 0xFFFFFFFF00000000LL) >> 0x20);
|
||||||
ol.Offset = (uint32_t)(offset & 0xFFFFFFFFLL);
|
ol.Offset = (uint32_t)(offset & 0xFFFFFFFFLL);
|
||||||
|
@ -465,7 +464,6 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset)
|
||||||
HANDLE handle = (HANDLE)_get_osfhandle(pFile->fd);
|
HANDLE handle = (HANDLE)_get_osfhandle(pFile->fd);
|
||||||
SetLastError(0);
|
SetLastError(0);
|
||||||
bool result = ReadFile(handle, buf, count, &ret, &ol);
|
bool result = ReadFile(handle, buf, count, &ret, &ol);
|
||||||
|
|
||||||
if (!result && GetLastError() != ERROR_HANDLE_EOF) {
|
if (!result && GetLastError() != ERROR_HANDLE_EOF) {
|
||||||
errno = GetLastError();
|
errno = GetLastError();
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -534,7 +532,6 @@ int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t
|
||||||
}
|
}
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
int64_t ret = 0;
|
int64_t ret = 0;
|
||||||
|
|
||||||
OVERLAPPED ol = {0};
|
OVERLAPPED ol = {0};
|
||||||
pl.OffsetHigh = (uint32_t)((offset & 0xFFFFFFFF00000000LL) >> 0x20);
|
pl.OffsetHigh = (uint32_t)((offset & 0xFFFFFFFF00000000LL) >> 0x20);
|
||||||
pl.Offset = (uint32_t)(offset & 0xFFFFFFFFLL);
|
pl.Offset = (uint32_t)(offset & 0xFFFFFFFFLL);
|
||||||
|
|
Loading…
Reference in New Issue