mdbx: add mdbx_osal.h with platform-like err codes.

This commit is contained in:
Leo Yuriev
2017-04-24 15:45:20 +03:00
parent f7507110ef
commit 2e54210e79
7 changed files with 265 additions and 232 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -337,7 +337,7 @@ int mdbx_pread(mdbx_filehandle_t fd, void *buf, size_t bytes, off_t offset) {
if (unlikely(!ReadFile(fd, buf, (DWORD)bytes, &read, &ov))) {
int rc = GetLastError();
if (rc == ERROR_HANDLE_EOF && read == 0 && offset == 0)
return ENOENT;
return MDBX_ENODATA;
return rc;
}
return (read == bytes) ? MDB_SUCCESS : ERROR_READ_FAULT;
@@ -347,7 +347,7 @@ int mdbx_pread(mdbx_filehandle_t fd, void *buf, size_t bytes, off_t offset) {
return MDB_SUCCESS;
if (read < 0)
return errno;
return (read == 0 && offset == 0) ? ENOENT : EIO;
return (read == 0 && offset == 0) ? MDBX_ENODATA : EIO;
#endif
}

View File

@@ -33,7 +33,6 @@
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <malloc.h>