mirror of
https://github.com/sqlite/sqlite.git
synced 2026-10-23 21:49:02 +03:00
Reduce the number of system calls in the os_win.c thunk from 81 down
to 58, as well as other simplifications. FossilOrigin-Name: c49521739c961ed5e38424bf26b2e34d8017a85122622ceac5af7398233fe343
This commit is contained in:
16
manifest
16
manifest
@@ -1,5 +1,5 @@
|
||||
C Further\ssimplifications\sto\sthe\sinterface\sto\sthe\sWindows\sfamily\sof\sOSes.\nAn\sincremental\scheck-in.
|
||||
D 2026-04-29T15:03:01.750
|
||||
C Reduce\sthe\snumber\sof\ssystem\scalls\sin\sthe\sos_win.c\sthunk\sfrom\s81\sdown\nto\s58,\sas\swell\sas\sother\ssimplifications.
|
||||
D 2026-04-29T16:09:47.869
|
||||
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
@@ -713,7 +713,7 @@ F src/mutex.c 00b8cee206a67fd764d001f3a148494331d8d0b3b9c3974ecd69ff29bb444462
|
||||
F src/mutex.h a7b2293c48db5f27007c3bdb21d438873637d12658f5a0bf8ad025bb96803c4a
|
||||
F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4
|
||||
F src/mutex_unix.c 9dce885059f9d2bb226e6e03bb2b41af4b89d40c323f908b58f5d05ff0565884
|
||||
F src/mutex_w32.c 554f4b0fda9c6891da9792f3479348cabcc4413d2acaed0646b63c3b9a7e0bca
|
||||
F src/mutex_w32.c ce7cae45dacae9897adee44db0264fb04d1a7c124ffa83a4308516ed088cbbad
|
||||
F src/notify.c 57c2d1a2805d6dee32acd5d250d928ab94e02d76369ae057dee7d445fd64e878
|
||||
F src/os.c 509452169d5ea739723e213b8e2481cf0e587f0e88579a912d200db5269f5f6d
|
||||
F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
|
||||
@@ -721,8 +721,8 @@ F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e
|
||||
F src/os_kv.c e7d96727db5b67e39d590a68cc61c86daf4c093c36c011a09ebfb521182ec28d
|
||||
F src/os_setup.h 8efc64eda6a6c2f221387eefc2e7e45fd5a3d5c8337a7a83519ba4fbd2957ae2
|
||||
F src/os_unix.c a07dce662f6c4e18098f6faa9f7ec7cf311f56ee9151bed2aad4dcd55852c9e2
|
||||
F src/os_win.c 9a3e4dc04959f905da7bbd35445c7e4b550809b6c61e0a836300d1076c2674b9
|
||||
F src/os_win.h 5e168adf482484327195d10f9c3bce3520f598e04e07ffe62c9c5a8067c1037b
|
||||
F src/os_win.c 4786b1123beea22a9cd8f8e9d781cc1b4bf4679c56103edbf60a519ce23a2781
|
||||
F src/os_win.h c06ccc3a090cf54202ea58981c298817f3309d4c9e4d52ad0a02927346493721
|
||||
F src/pager.c fbec9063ea139dfa5d94ce540671752b89f8e8dc38f8a1f614bab1aa04a2dd40
|
||||
F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8
|
||||
F src/parse.y 8c8003a932f6f98ac612fd239d3cdc7ca64480f61ca5f4f680c4fe69b1bc68c9
|
||||
@@ -2203,8 +2203,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
|
||||
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
|
||||
P 4dbc4d19c4f3b58d0bedd766cfba65d9624903a5ab0a340eb83ddeec058607ea
|
||||
R dd5df35055cc8dd1d3aa594c7e915c15
|
||||
P f2aa6b66d2a1b5bb2dc8a44788a061a549a846244354df19b44398839578461e
|
||||
R 2b3672c838a493907ddf438bd7d4e49c
|
||||
U drh
|
||||
Z c6e5c7c801ab6e4380d92ca2bd186f5f
|
||||
Z 76bc5d65524dba7586bb6560dacbd1e4
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
@@ -1 +1 @@
|
||||
f2aa6b66d2a1b5bb2dc8a44788a061a549a846244354df19b44398839578461e
|
||||
c49521739c961ed5e38424bf26b2e34d8017a85122622ceac5af7398233fe343
|
||||
|
||||
@@ -104,7 +104,7 @@ static int winMutex_isInit = 0;
|
||||
** of the sqlite3_initialize() and sqlite3_shutdown() processing, the
|
||||
** "interlocked" magic used here is probably not strictly necessary.
|
||||
*/
|
||||
static LONG SQLITE_WIN32_VOLATILE winMutex_lock = 0;
|
||||
static LONG volatile winMutex_lock = 0;
|
||||
|
||||
void sqlite3_win32_sleep(DWORD milliseconds); /* os_win.c */
|
||||
|
||||
|
||||
276
src/os_win.c
276
src/os_win.c
@@ -352,9 +352,9 @@ const sqlite3_mem_methods *sqlite3MemGetWin32(void);
|
||||
** can manually set this value to 1 to emulate Win98 behavior.
|
||||
*/
|
||||
#ifdef SQLITE_TEST
|
||||
LONG SQLITE_WIN32_VOLATILE sqlite3_os_type = 0;
|
||||
LONG volatile sqlite3_os_type = 0;
|
||||
#else
|
||||
static LONG SQLITE_WIN32_VOLATILE sqlite3_os_type = 0;
|
||||
static LONG volatile sqlite3_os_type = 0;
|
||||
#endif
|
||||
|
||||
#ifndef SYSCALL
|
||||
@@ -375,64 +375,27 @@ static struct win_syscall {
|
||||
{ "AreFileApisANSI", (SYSCALL)AreFileApisANSI, 0 },
|
||||
#define osAreFileApisANSI ((BOOL(WINAPI*)(VOID))aSyscall[0].pCurrent)
|
||||
|
||||
{ "CharLowerW", (SYSCALL)0, 0 },
|
||||
#define osCharLowerW ((LPWSTR(WINAPI*)(LPWSTR))aSyscall[1].pCurrent)
|
||||
|
||||
{ "CharUpperW", (SYSCALL)0, 0 },
|
||||
#define osCharUpperW ((LPWSTR(WINAPI*)(LPWSTR))aSyscall[2].pCurrent)
|
||||
|
||||
{ "CloseHandle", (SYSCALL)CloseHandle, 0 },
|
||||
#define osCloseHandle ((BOOL(WINAPI*)(HANDLE))aSyscall[1].pCurrent)
|
||||
|
||||
#define osCloseHandle ((BOOL(WINAPI*)(HANDLE))aSyscall[3].pCurrent)
|
||||
|
||||
{ "CreateFileA", (SYSCALL)0, 0 },
|
||||
|
||||
#define osCreateFileA ((HANDLE(WINAPI*)(LPCSTR,DWORD,DWORD, \
|
||||
LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[4].pCurrent)
|
||||
|
||||
{ "CreateFileW", (SYSCALL)CreateFileW, 0 },
|
||||
#define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \
|
||||
LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent)
|
||||
|
||||
{ "CreateFileMappingA", (SYSCALL)0, 0 },
|
||||
#define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
|
||||
DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent)
|
||||
LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[2].pCurrent)
|
||||
|
||||
{ "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 },
|
||||
#define osCreateFileMappingW ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
|
||||
DWORD,DWORD,DWORD,LPCWSTR))aSyscall[7].pCurrent)
|
||||
|
||||
{ "CreateMutexW", (SYSCALL)CreateMutexW, 0 },
|
||||
#define osCreateMutexW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,BOOL, \
|
||||
LPCWSTR))aSyscall[8].pCurrent)
|
||||
|
||||
{ "DeleteFileA", (SYSCALL)0, 0 },
|
||||
|
||||
#define osDeleteFileA ((BOOL(WINAPI*)(LPCSTR))aSyscall[9].pCurrent)
|
||||
DWORD,DWORD,DWORD,LPCWSTR))aSyscall[3].pCurrent)
|
||||
|
||||
{ "DeleteFileW", (SYSCALL)DeleteFileW, 0 },
|
||||
#define osDeleteFileW ((BOOL(WINAPI*)(LPCWSTR))aSyscall[10].pCurrent)
|
||||
|
||||
{ "FileTimeToLocalFileTime", (SYSCALL)0, 0 },
|
||||
#define osFileTimeToLocalFileTime ((BOOL(WINAPI*)(const FILETIME*, \
|
||||
LPFILETIME))aSyscall[11].pCurrent)
|
||||
|
||||
{ "FileTimeToSystemTime", (SYSCALL)FileTimeToSystemTime, 0 },
|
||||
#define osFileTimeToSystemTime ((BOOL(WINAPI*)(const FILETIME*, \
|
||||
LPSYSTEMTIME))aSyscall[12].pCurrent)
|
||||
#define osDeleteFileW ((BOOL(WINAPI*)(LPCWSTR))aSyscall[4].pCurrent)
|
||||
|
||||
{ "FlushFileBuffers", (SYSCALL)FlushFileBuffers, 0 },
|
||||
|
||||
#define osFlushFileBuffers ((BOOL(WINAPI*)(HANDLE))aSyscall[13].pCurrent)
|
||||
|
||||
{ "FormatMessageA", (SYSCALL)FormatMessageA, 0 },
|
||||
|
||||
#define osFormatMessageA ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPSTR, \
|
||||
DWORD,va_list*))aSyscall[14].pCurrent)
|
||||
#define osFlushFileBuffers ((BOOL(WINAPI*)(HANDLE))aSyscall[5].pCurrent)
|
||||
|
||||
{ "FormatMessageW", (SYSCALL)FormatMessageW, 0 },
|
||||
#define osFormatMessageW ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPWSTR, \
|
||||
DWORD,va_list*))aSyscall[15].pCurrent)
|
||||
DWORD,va_list*))aSyscall[6].pCurrent)
|
||||
|
||||
#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
||||
{ "FreeLibrary", (SYSCALL)FreeLibrary, 0 },
|
||||
@@ -440,252 +403,158 @@ static struct win_syscall {
|
||||
{ "FreeLibrary", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osFreeLibrary ((BOOL(WINAPI*)(HMODULE))aSyscall[16].pCurrent)
|
||||
#define osFreeLibrary ((BOOL(WINAPI*)(HMODULE))aSyscall[7].pCurrent)
|
||||
|
||||
{ "GetCurrentProcessId", (SYSCALL)GetCurrentProcessId, 0 },
|
||||
|
||||
#define osGetCurrentProcessId ((DWORD(WINAPI*)(VOID))aSyscall[17].pCurrent)
|
||||
|
||||
{ "GetDiskFreeSpaceA", (SYSCALL)0, 0 },
|
||||
|
||||
#define osGetDiskFreeSpaceA ((BOOL(WINAPI*)(LPCSTR,LPDWORD,LPDWORD,LPDWORD, \
|
||||
LPDWORD))aSyscall[18].pCurrent)
|
||||
|
||||
{ "GetDiskFreeSpaceW", (SYSCALL)GetDiskFreeSpaceW, 0 },
|
||||
#define osGetDiskFreeSpaceW ((BOOL(WINAPI*)(LPCWSTR,LPDWORD,LPDWORD,LPDWORD, \
|
||||
LPDWORD))aSyscall[19].pCurrent)
|
||||
|
||||
{ "GetFileAttributesA", (SYSCALL)0, 0 },
|
||||
|
||||
#define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[20].pCurrent)
|
||||
#define osGetCurrentProcessId ((DWORD(WINAPI*)(VOID))aSyscall[8].pCurrent)
|
||||
|
||||
{ "GetFileAttributesW", (SYSCALL)GetFileAttributesW, 0 },
|
||||
#define osGetFileAttributesW ((DWORD(WINAPI*)(LPCWSTR))aSyscall[21].pCurrent)
|
||||
#define osGetFileAttributesW ((DWORD(WINAPI*)(LPCWSTR))aSyscall[9].pCurrent)
|
||||
|
||||
{ "GetFileAttributesExW", (SYSCALL)GetFileAttributesExW, 0 },
|
||||
#define osGetFileAttributesExW ((BOOL(WINAPI*)(LPCWSTR,GET_FILEEX_INFO_LEVELS, \
|
||||
LPVOID))aSyscall[22].pCurrent)
|
||||
LPVOID))aSyscall[10].pCurrent)
|
||||
|
||||
{ "GetFileSize", (SYSCALL)GetFileSize, 0 },
|
||||
|
||||
#define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[23].pCurrent)
|
||||
|
||||
{ "GetFullPathNameA", (SYSCALL)0, 0 },
|
||||
|
||||
#define osGetFullPathNameA ((DWORD(WINAPI*)(LPCSTR,DWORD,LPSTR, \
|
||||
LPSTR*))aSyscall[24].pCurrent)
|
||||
#define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[11].pCurrent)
|
||||
|
||||
{ "GetFullPathNameW", (SYSCALL)GetFullPathNameW, 0 },
|
||||
|
||||
#define osGetFullPathNameW ((DWORD(WINAPI*)(LPCWSTR,DWORD,LPWSTR, \
|
||||
LPWSTR*))aSyscall[25].pCurrent)
|
||||
LPWSTR*))aSyscall[12].pCurrent)
|
||||
|
||||
/*
|
||||
** For GetLastError(), MSDN says:
|
||||
**
|
||||
** Minimum supported client: Windows XP [desktop apps | UWP apps]
|
||||
** Minimum supported server: Windows Server 2003 [desktop apps | UWP apps]
|
||||
*/
|
||||
{ "GetLastError", (SYSCALL)GetLastError, 0 },
|
||||
|
||||
#define osGetLastError ((DWORD(WINAPI*)(VOID))aSyscall[26].pCurrent)
|
||||
#define osGetLastError ((DWORD(WINAPI*)(VOID))aSyscall[13].pCurrent)
|
||||
|
||||
#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
||||
{ "GetProcAddressA", (SYSCALL)GetProcAddress, 0 },
|
||||
#else
|
||||
{ "GetProcAddressA", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osGetProcAddressA ((FARPROC(WINAPI*)(HMODULE, \
|
||||
LPCSTR))aSyscall[27].pCurrent)
|
||||
LPCSTR))aSyscall[14].pCurrent)
|
||||
|
||||
{ "GetSystemInfo", (SYSCALL)GetSystemInfo, 0 },
|
||||
#define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[28].pCurrent)
|
||||
#define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[15].pCurrent)
|
||||
|
||||
{ "GetSystemTime", (SYSCALL)GetSystemTime, 0 },
|
||||
#define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[29].pCurrent)
|
||||
#define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[16].pCurrent)
|
||||
|
||||
{ "GetSystemTimeAsFileTime", (SYSCALL)GetSystemTimeAsFileTime, 0 },
|
||||
#define osGetSystemTimeAsFileTime ((VOID(WINAPI*)( \
|
||||
LPFILETIME))aSyscall[30].pCurrent)
|
||||
|
||||
{ "GetTempPathA", (SYSCALL)0, 0 },
|
||||
|
||||
#define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[31].pCurrent)
|
||||
LPFILETIME))aSyscall[17].pCurrent)
|
||||
|
||||
{ "GetTempPathW", (SYSCALL)GetTempPathW, 0 },
|
||||
#define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[32].pCurrent)
|
||||
#define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[18].pCurrent)
|
||||
|
||||
{ "GetTickCount", (SYSCALL)GetTickCount, 0 },
|
||||
|
||||
#define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[33].pCurrent)
|
||||
|
||||
{ "GetVersionExA", (SYSCALL)0, 0 },
|
||||
#define osGetVersionExA ((BOOL(WINAPI*)( \
|
||||
LPOSVERSIONINFOA))aSyscall[34].pCurrent)
|
||||
|
||||
{ "GetVersionExW", (SYSCALL)0, 0 },
|
||||
#define osGetVersionExW ((BOOL(WINAPI*)( \
|
||||
LPOSVERSIONINFOW))aSyscall[35].pCurrent)
|
||||
#define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[19].pCurrent)
|
||||
|
||||
{ "HeapAlloc", (SYSCALL)HeapAlloc, 0 },
|
||||
|
||||
#define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \
|
||||
SIZE_T))aSyscall[36].pCurrent)
|
||||
SIZE_T))aSyscall[20].pCurrent)
|
||||
|
||||
{ "HeapCreate", (SYSCALL)HeapCreate, 0 },
|
||||
|
||||
#define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \
|
||||
SIZE_T))aSyscall[37].pCurrent)
|
||||
SIZE_T))aSyscall[21].pCurrent)
|
||||
|
||||
{ "HeapDestroy", (SYSCALL)HeapDestroy, 0 },
|
||||
|
||||
#define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[38].pCurrent)
|
||||
#define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[22].pCurrent)
|
||||
|
||||
{ "HeapFree", (SYSCALL)HeapFree, 0 },
|
||||
|
||||
#define osHeapFree ((BOOL(WINAPI*)(HANDLE,DWORD,LPVOID))aSyscall[39].pCurrent)
|
||||
#define osHeapFree ((BOOL(WINAPI*)(HANDLE,DWORD,LPVOID))aSyscall[23].pCurrent)
|
||||
|
||||
{ "HeapReAlloc", (SYSCALL)HeapReAlloc, 0 },
|
||||
|
||||
#define osHeapReAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD,LPVOID, \
|
||||
SIZE_T))aSyscall[40].pCurrent)
|
||||
SIZE_T))aSyscall[24].pCurrent)
|
||||
|
||||
{ "HeapSize", (SYSCALL)HeapSize, 0 },
|
||||
|
||||
#define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \
|
||||
LPCVOID))aSyscall[41].pCurrent)
|
||||
LPCVOID))aSyscall[25].pCurrent)
|
||||
|
||||
{ "HeapValidate", (SYSCALL)HeapValidate, 0 },
|
||||
|
||||
#define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \
|
||||
LPCVOID))aSyscall[42].pCurrent)
|
||||
LPCVOID))aSyscall[26].pCurrent)
|
||||
|
||||
{ "HeapCompact", (SYSCALL)HeapCompact, 0 },
|
||||
#define osHeapCompact ((UINT(WINAPI*)(HANDLE,DWORD))aSyscall[27].pCurrent)
|
||||
|
||||
#define osHeapCompact ((UINT(WINAPI*)(HANDLE,DWORD))aSyscall[43].pCurrent)
|
||||
|
||||
{ "LoadLibraryA", (SYSCALL)0, 0 },
|
||||
|
||||
#define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[44].pCurrent)
|
||||
|
||||
#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
||||
{ "LoadLibraryW", (SYSCALL)LoadLibraryW, 0 },
|
||||
#else
|
||||
{ "LoadLibraryW", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[45].pCurrent)
|
||||
#define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[28].pCurrent)
|
||||
|
||||
{ "LocalFree", (SYSCALL)LocalFree, 0 },
|
||||
|
||||
#define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[46].pCurrent)
|
||||
|
||||
{ "LockFile", (SYSCALL)LockFile, 0 },
|
||||
|
||||
#define osLockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
|
||||
DWORD))aSyscall[47].pCurrent)
|
||||
#define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[29].pCurrent)
|
||||
|
||||
{ "LockFileEx", (SYSCALL)LockFileEx, 0 },
|
||||
|
||||
#define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \
|
||||
LPOVERLAPPED))aSyscall[48].pCurrent)
|
||||
LPOVERLAPPED))aSyscall[30].pCurrent)
|
||||
|
||||
#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
|
||||
{ "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 },
|
||||
#else
|
||||
{ "MapViewOfFile", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osMapViewOfFile ((LPVOID(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
|
||||
SIZE_T))aSyscall[49].pCurrent)
|
||||
SIZE_T))aSyscall[31].pCurrent)
|
||||
|
||||
{ "MultiByteToWideChar", (SYSCALL)MultiByteToWideChar, 0 },
|
||||
|
||||
#define osMultiByteToWideChar ((int(WINAPI*)(UINT,DWORD,LPCSTR,int,LPWSTR, \
|
||||
int))aSyscall[50].pCurrent)
|
||||
int))aSyscall[32].pCurrent)
|
||||
|
||||
{ "QueryPerformanceCounter", (SYSCALL)QueryPerformanceCounter, 0 },
|
||||
|
||||
#define osQueryPerformanceCounter ((BOOL(WINAPI*)( \
|
||||
LARGE_INTEGER*))aSyscall[51].pCurrent)
|
||||
LARGE_INTEGER*))aSyscall[33].pCurrent)
|
||||
|
||||
{ "ReadFile", (SYSCALL)ReadFile, 0 },
|
||||
|
||||
#define osReadFile ((BOOL(WINAPI*)(HANDLE,LPVOID,DWORD,LPDWORD, \
|
||||
LPOVERLAPPED))aSyscall[52].pCurrent)
|
||||
LPOVERLAPPED))aSyscall[34].pCurrent)
|
||||
|
||||
{ "SetEndOfFile", (SYSCALL)SetEndOfFile, 0 },
|
||||
|
||||
#define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[53].pCurrent)
|
||||
#define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[35].pCurrent)
|
||||
|
||||
{ "SetFilePointer", (SYSCALL)SetFilePointer, 0 },
|
||||
|
||||
#define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \
|
||||
DWORD))aSyscall[54].pCurrent)
|
||||
DWORD))aSyscall[36].pCurrent)
|
||||
|
||||
{ "Sleep", (SYSCALL)Sleep, 0 },
|
||||
|
||||
#define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[55].pCurrent)
|
||||
|
||||
{ "SystemTimeToFileTime", (SYSCALL)SystemTimeToFileTime, 0 },
|
||||
|
||||
#define osSystemTimeToFileTime ((BOOL(WINAPI*)(const SYSTEMTIME*, \
|
||||
LPFILETIME))aSyscall[56].pCurrent)
|
||||
|
||||
{ "UnlockFile", (SYSCALL)UnlockFile, 0 },
|
||||
|
||||
#define osUnlockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
|
||||
DWORD))aSyscall[57].pCurrent)
|
||||
#define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[37].pCurrent)
|
||||
|
||||
{ "UnlockFileEx", (SYSCALL)UnlockFileEx, 0 },
|
||||
|
||||
#define osUnlockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
|
||||
LPOVERLAPPED))aSyscall[58].pCurrent)
|
||||
LPOVERLAPPED))aSyscall[38].pCurrent)
|
||||
|
||||
#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
|
||||
{ "UnmapViewOfFile", (SYSCALL)UnmapViewOfFile, 0 },
|
||||
#else
|
||||
{ "UnmapViewOfFile", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osUnmapViewOfFile ((BOOL(WINAPI*)(LPCVOID))aSyscall[59].pCurrent)
|
||||
#define osUnmapViewOfFile ((BOOL(WINAPI*)(LPCVOID))aSyscall[39].pCurrent)
|
||||
|
||||
{ "WideCharToMultiByte", (SYSCALL)WideCharToMultiByte, 0 },
|
||||
|
||||
#define osWideCharToMultiByte ((int(WINAPI*)(UINT,DWORD,LPCWSTR,int,LPSTR,int, \
|
||||
LPCSTR,LPBOOL))aSyscall[60].pCurrent)
|
||||
LPCSTR,LPBOOL))aSyscall[40].pCurrent)
|
||||
|
||||
{ "WriteFile", (SYSCALL)WriteFile, 0 },
|
||||
|
||||
#define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \
|
||||
LPOVERLAPPED))aSyscall[61].pCurrent)
|
||||
LPOVERLAPPED))aSyscall[41].pCurrent)
|
||||
|
||||
{ "WaitForSingleObject", (SYSCALL)WaitForSingleObject, 0 },
|
||||
|
||||
#define osWaitForSingleObject ((DWORD(WINAPI*)(HANDLE, \
|
||||
DWORD))aSyscall[62].pCurrent)
|
||||
DWORD))aSyscall[42].pCurrent)
|
||||
|
||||
{ "WaitForSingleObjectEx", (SYSCALL)WaitForSingleObjectEx, 0 },
|
||||
|
||||
#define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \
|
||||
BOOL))aSyscall[63].pCurrent)
|
||||
|
||||
{ "GetNativeSystemInfo", (SYSCALL)GetNativeSystemInfo, 0 },
|
||||
|
||||
#define osGetNativeSystemInfo ((VOID(WINAPI*)( \
|
||||
LPSYSTEM_INFO))aSyscall[64].pCurrent)
|
||||
BOOL))aSyscall[43].pCurrent)
|
||||
|
||||
{ "OutputDebugStringA", (SYSCALL)OutputDebugStringA, 0 },
|
||||
|
||||
#define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[65].pCurrent)
|
||||
|
||||
{ "OutputDebugStringW", (SYSCALL)OutputDebugStringW, 0 },
|
||||
#define osOutputDebugStringW ((VOID(WINAPI*)(LPCWSTR))aSyscall[66].pCurrent)
|
||||
#define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[44].pCurrent)
|
||||
|
||||
{ "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 },
|
||||
|
||||
#define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[67].pCurrent)
|
||||
#define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[45].pCurrent)
|
||||
|
||||
/*
|
||||
** NOTE: On some sub-platforms, the InterlockedCompareExchange "function"
|
||||
@@ -694,13 +563,11 @@ static struct win_syscall {
|
||||
*/
|
||||
#if defined(InterlockedCompareExchange)
|
||||
{ "InterlockedCompareExchange", (SYSCALL)0, 0 },
|
||||
|
||||
#define osInterlockedCompareExchange InterlockedCompareExchange
|
||||
#else
|
||||
{ "InterlockedCompareExchange", (SYSCALL)InterlockedCompareExchange, 0 },
|
||||
|
||||
#define osInterlockedCompareExchange ((LONG(WINAPI*)(LONG \
|
||||
SQLITE_WIN32_VOLATILE*, LONG,LONG))aSyscall[68].pCurrent)
|
||||
#define osInterlockedCompareExchange ((LONG(WINAPI*)(LONG volatile*,\
|
||||
LONG,LONG))aSyscall[46].pCurrent)
|
||||
#endif /* defined(InterlockedCompareExchange) */
|
||||
|
||||
#if SQLITE_WIN32_USE_UUID
|
||||
@@ -708,36 +575,32 @@ static struct win_syscall {
|
||||
#else
|
||||
{ "UuidCreate", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[69].pCurrent)
|
||||
#define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[47].pCurrent)
|
||||
|
||||
#if SQLITE_WIN32_USE_UUID
|
||||
{ "UuidCreateSequential", (SYSCALL)UuidCreateSequential, 0 },
|
||||
#else
|
||||
{ "UuidCreateSequential", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osUuidCreateSequential \
|
||||
((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[70].pCurrent)
|
||||
((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[48].pCurrent)
|
||||
|
||||
#if !defined(SQLITE_NO_SYNC) && SQLITE_MAX_MMAP_SIZE>0
|
||||
{ "FlushViewOfFile", (SYSCALL)FlushViewOfFile, 0 },
|
||||
#else
|
||||
{ "FlushViewOfFile", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osFlushViewOfFile \
|
||||
((BOOL(WINAPI*)(LPCVOID,SIZE_T))aSyscall[71].pCurrent)
|
||||
((BOOL(WINAPI*)(LPCVOID,SIZE_T))aSyscall[49].pCurrent)
|
||||
|
||||
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
|
||||
{ "CreateEvent", (SYSCALL)CreateEvent, 0 },
|
||||
#else
|
||||
{ "CreateEvent", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osCreateEvent ( \
|
||||
(HANDLE(WINAPI*) (LPSECURITY_ATTRIBUTES,BOOL,BOOL,LPCSTR)) \
|
||||
aSyscall[72].pCurrent \
|
||||
aSyscall[50].pCurrent \
|
||||
)
|
||||
|
||||
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
|
||||
@@ -745,60 +608,50 @@ static struct win_syscall {
|
||||
#else
|
||||
{ "CancelIo", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osCancelIo ((BOOL(WINAPI*)(HANDLE))aSyscall[73].pCurrent)
|
||||
|
||||
{ "GetModuleHandleW", (SYSCALL)GetModuleHandleW, 0 },
|
||||
#define osGetModuleHandleW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[74].pCurrent)
|
||||
#define osCancelIo ((BOOL(WINAPI*)(HANDLE))aSyscall[51].pCurrent)
|
||||
|
||||
#ifndef _WIN32
|
||||
{ "getenv", (SYSCALL)getenv, 0 },
|
||||
#else
|
||||
{ "getenv", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osGetenv ((const char *(*)(const char *))aSyscall[75].pCurrent)
|
||||
#define osGetenv ((const char *(*)(const char *))aSyscall[52].pCurrent)
|
||||
|
||||
#ifndef _WIN32
|
||||
{ "getcwd", (SYSCALL)getcwd, 0 },
|
||||
#else
|
||||
{ "getcwd", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osGetcwd ((char*(*)(char*,size_t))aSyscall[76].pCurrent)
|
||||
#define osGetcwd ((char*(*)(char*,size_t))aSyscall[53].pCurrent)
|
||||
|
||||
#ifndef _WIN32
|
||||
{ "readlink", (SYSCALL)readlink, 0 },
|
||||
#else
|
||||
{ "readlink", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[77].pCurrent)
|
||||
#define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[54].pCurrent)
|
||||
|
||||
#ifndef _WIN32
|
||||
{ "lstat", (SYSCALL)lstat, 0 },
|
||||
#else
|
||||
{ "lstat", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osLstat ((int(*)(const char*,struct stat*))aSyscall[78].pCurrent)
|
||||
#define osLstat ((int(*)(const char*,struct stat*))aSyscall[55].pCurrent)
|
||||
|
||||
#ifndef _WIN32
|
||||
{ "__errno", (SYSCALL)__errno, 0 },
|
||||
#else
|
||||
{ "__errno", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osErrno (*((int*(*)(void))aSyscall[79].pCurrent)())
|
||||
#define osErrno (*((int*(*)(void))aSyscall[56].pCurrent)())
|
||||
|
||||
#ifndef _WIN32
|
||||
{ "cygwin_conv_path", (SYSCALL)cygwin_conv_path, 0 },
|
||||
#else
|
||||
{ "cygwin_conv_path", (SYSCALL)0, 0 },
|
||||
#endif
|
||||
|
||||
#define osCygwin_conv_path ((size_t(*)(unsigned int, \
|
||||
const void *, void *, size_t))aSyscall[80].pCurrent)
|
||||
const void *, void *, size_t))aSyscall[57].pCurrent)
|
||||
|
||||
}; /* End of the overrideable system calls */
|
||||
|
||||
@@ -5377,12 +5230,11 @@ int sqlite3_os_init(void){
|
||||
|
||||
/* Double-check that the aSyscall[] array has been constructed
|
||||
** correctly. See ticket [bb3a86e890c8e96ab] */
|
||||
assert( ArraySize(aSyscall)==81 );
|
||||
assert( ArraySize(aSyscall)==58 );
|
||||
assert( strcmp(aSyscall[0].zName,"AreFileApisANSI")==0 );
|
||||
assert( strcmp(aSyscall[20].zName,"GetFileAttributesA")==0 );
|
||||
assert( strcmp(aSyscall[40].zName,"HeapReAlloc")==0 );
|
||||
assert( strcmp(aSyscall[60].zName,"WideCharToMultiByte")==0 );
|
||||
assert( strcmp(aSyscall[80].zName,"cygwin_conv_path")==0 );
|
||||
assert( strcmp(aSyscall[20].zName,"HeapAlloc")==0 );
|
||||
assert( strcmp(aSyscall[40].zName,"WideCharToMultiByte")==0 );
|
||||
assert( strcmp(aSyscall[57].zName,"cygwin_conv_path")==0 );
|
||||
|
||||
/* get memory map allocation granularity */
|
||||
memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));
|
||||
|
||||
44
src/os_win.h
44
src/os_win.h
@@ -27,53 +27,11 @@
|
||||
# include <errno.h> /* amalgamator: dontcache */
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Determine if we are dealing with Windows NT.
|
||||
**
|
||||
** We ought to be able to determine if we are compiling for Windows 9x or
|
||||
** Windows NT using the _WIN32_WINNT macro as follows:
|
||||
**
|
||||
** #if defined(_WIN32_WINNT)
|
||||
** # define SQLITE_OS_WINNT 1
|
||||
** #else
|
||||
** # define SQLITE_OS_WINNT 0
|
||||
** #endif
|
||||
**
|
||||
** However, Visual Studio 2005 does not set _WIN32_WINNT by default, as
|
||||
** it ought to, so the above test does not work. We'll just assume that
|
||||
** everything is Windows NT unless the programmer explicitly says otherwise
|
||||
** by setting SQLITE_OS_WINNT to 0.
|
||||
*/
|
||||
#if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT)
|
||||
# define SQLITE_OS_WINNT 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Determine if we are dealing with Windows CE - which has a much reduced
|
||||
** API.
|
||||
*/
|
||||
#if defined(_WIN32_WCE)
|
||||
# define SQLITE_OS_WINCE 1
|
||||
#else
|
||||
# define SQLITE_OS_WINCE 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
** For WinCE, some API function parameters do not appear to be declared as
|
||||
** volatile.
|
||||
*/
|
||||
#if SQLITE_OS_WINCE
|
||||
# define SQLITE_WIN32_VOLATILE
|
||||
#else
|
||||
# define SQLITE_WIN32_VOLATILE volatile
|
||||
#endif
|
||||
|
||||
/*
|
||||
** For some Windows sub-platforms, the _beginthreadex() / _endthreadex()
|
||||
** functions are not available (e.g. those not using MSVC, Cygwin, etc).
|
||||
*/
|
||||
#if SQLITE_OS_WIN && !SQLITE_OS_WINCE && \
|
||||
SQLITE_THREADSAFE>0 && !defined(__CYGWIN__)
|
||||
#if SQLITE_OS_WIN && SQLITE_THREADSAFE>0 && !defined(__CYGWIN__)
|
||||
# define SQLITE_OS_WIN_THREADS 1
|
||||
#else
|
||||
# define SQLITE_OS_WIN_THREADS 0
|
||||
|
||||
Reference in New Issue
Block a user