Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | When compiled for WinRT, avoid using MapViewOfFile and GetFileAttributes. Also, reset the private 'sleep' event handle when the VFS is cleaned up. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | winrt |
Files: | files | file ages | folders |
SHA1: |
38df8fc1b49d55b61cb168a61134b4a3 |
User & Date: | mistachkin 2012-03-03 13:15:25.497 |
Context
2012-03-04
| ||
02:56 | When creating the event used to sleep on WinRT, request the minimum access rights required for the desired operations on it (i.e. SYNCHRONIZE). (check-in: ed603d7594 user: mistachkin tags: winrt) | |
2012-03-03
| ||
13:15 | When compiled for WinRT, avoid using MapViewOfFile and GetFileAttributes. Also, reset the private 'sleep' event handle when the VFS is cleaned up. (check-in: 38df8fc1b4 user: mistachkin tags: winrt) | |
2012-03-02
| ||
23:53 | When compiled for WinRT, avoid using the FORMAT_MESSAGE_ALLOCATE_BUFFER flag to FormatMessage (i.e. because LocalFree is unavailable). (check-in: 9eb331be7e user: mistachkin tags: winrt) | |
Changes
Changes to src/os_win.c.
︙ | ︙ | |||
661 662 663 664 665 666 667 668 669 670 671 672 673 674 | { "GetFileInformationByHandleEx", (SYSCALL)GetFileInformationByHandleEx, 0 }, #define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \ FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[64].pCurrent) #else { "GetFileInformationByHandleEx", (SYSCALL)0, 0 }, #endif }; /* End of the overrideable system calls */ /* ** This is the xSetSystemCall() method of sqlite3_vfs for all of the ** "win32" VFSes. Return SQLITE_OK opon successfully updating the ** system call pointer, or SQLITE_NOTFOUND if there is no configurable | > > > > > | 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | { "GetFileInformationByHandleEx", (SYSCALL)GetFileInformationByHandleEx, 0 }, #define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \ FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[64].pCurrent) #else { "GetFileInformationByHandleEx", (SYSCALL)0, 0 }, #endif { "MapViewOfFileEx", (SYSCALL)MapViewOfFileEx, 0 }, #define osMapViewOfFileEx ((LPVOID(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,SIZE_T, \ LPVOID))aSyscall[65].pCurrent) }; /* End of the overrideable system calls */ /* ** This is the xSetSystemCall() method of sqlite3_vfs for all of the ** "win32" VFSes. Return SQLITE_OK opon successfully updating the ** system call pointer, or SQLITE_NOTFOUND if there is no configurable |
︙ | ︙ | |||
2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 | ); OSTRACE(("SHM-MAP pid-%d create region=%d nbyte=%d %s\n", (int)osGetCurrentProcessId(), pShmNode->nRegion, nByte, hMap ? "ok" : "failed")); if( hMap ){ int iOffset = pShmNode->nRegion*szRegion; int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity; pMap = osMapViewOfFile(hMap, FILE_MAP_WRITE | FILE_MAP_READ, 0, iOffset - iOffsetShift, szRegion + iOffsetShift ); OSTRACE(("SHM-MAP pid-%d map region=%d offset=%d size=%d %s\n", (int)osGetCurrentProcessId(), pShmNode->nRegion, iOffset, szRegion, pMap ? "ok" : "failed")); } if( !pMap ){ pShmNode->lastErrno = osGetLastError(); rc = winLogError(SQLITE_IOERR_SHMMAP, pShmNode->lastErrno, | > > > > > > | 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 | ); OSTRACE(("SHM-MAP pid-%d create region=%d nbyte=%d %s\n", (int)osGetCurrentProcessId(), pShmNode->nRegion, nByte, hMap ? "ok" : "failed")); if( hMap ){ int iOffset = pShmNode->nRegion*szRegion; int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity; #if SQLITE_OS_WINRT pMap = osMapViewOfFileEx(hMap, FILE_MAP_WRITE | FILE_MAP_READ, 0, iOffset - iOffsetShift, szRegion + iOffsetShift, NULL ); #else pMap = osMapViewOfFile(hMap, FILE_MAP_WRITE | FILE_MAP_READ, 0, iOffset - iOffsetShift, szRegion + iOffsetShift ); #endif OSTRACE(("SHM-MAP pid-%d map region=%d offset=%d size=%d %s\n", (int)osGetCurrentProcessId(), pShmNode->nRegion, iOffset, szRegion, pMap ? "ok" : "failed")); } if( !pMap ){ pShmNode->lastErrno = osGetLastError(); rc = winLogError(SQLITE_IOERR_SHMMAP, pShmNode->lastErrno, |
︙ | ︙ | |||
3415 3416 3417 3418 3419 3420 3421 3422 | UNUSED_PARAMETER(syncDir); SimulateIOError(return SQLITE_IOERR_DELETE); zConverted = convertUtf8Filename(zFilename); if( zConverted==0 ){ return SQLITE_IOERR_NOMEM; } if( isNT() ){ | > > > > > | > > < | 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 | UNUSED_PARAMETER(syncDir); SimulateIOError(return SQLITE_IOERR_DELETE); zConverted = convertUtf8Filename(zFilename); if( zConverted==0 ){ return SQLITE_IOERR_NOMEM; } rc = 1; if( isNT() ){ #if SQLITE_OS_WINRT WIN32_FILE_ATTRIBUTE_DATA sAttrData; memset(&sAttrData, 0, sizeof(sAttrData)); while( osGetFileAttributesExW(zConverted, GetFileExInfoStandard, &sAttrData) && #else while( osGetFileAttributesW(zConverted)!=INVALID_FILE_ATTRIBUTES && #endif (rc = osDeleteFileW(zConverted))==0 && retryIoerr(&cnt, &lastErrno) ){} rc = rc ? SQLITE_OK : SQLITE_ERROR; } #ifdef SQLITE_WIN32_HAS_ANSI else{ while( osGetFileAttributesA(zConverted)!=INVALID_FILE_ATTRIBUTES && (rc = osDeleteFileA(zConverted))==0 && retryIoerr(&cnt, &lastErrno) ){} rc = rc ? SQLITE_OK : SQLITE_ERROR; } #endif if( rc ){ rc = winLogError(SQLITE_IOERR_DELETE, lastErrno, |
︙ | ︙ | |||
3830 3831 3832 3833 3834 3835 3836 | winSetSystemCall, /* xSetSystemCall */ winGetSystemCall, /* xGetSystemCall */ winNextSystemCall, /* xNextSystemCall */ }; /* Double-check that the aSyscall[] array has been constructed ** correctly. See ticket [bb3a86e890c8e96ab] */ | | > | 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 | winSetSystemCall, /* xSetSystemCall */ winGetSystemCall, /* xGetSystemCall */ winNextSystemCall, /* xNextSystemCall */ }; /* Double-check that the aSyscall[] array has been constructed ** correctly. See ticket [bb3a86e890c8e96ab] */ assert( ArraySize(aSyscall)==66 ); #if SQLITE_OS_WINRT sleepObj = osCreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS); #endif #ifndef SQLITE_OMIT_WAL /* get memory map allocation granularity */ memset(&winSysInfo, 0, sizeof(SYSTEM_INFO)); osGetSystemInfo(&winSysInfo); assert(winSysInfo.dwAllocationGranularity > 0); #endif sqlite3_vfs_register(&winVfs, 1); return SQLITE_OK; } int sqlite3_os_end(void){ #if SQLITE_OS_WINRT osCloseHandle(sleepObj); sleepObj = NULL; #endif return SQLITE_OK; } #endif /* SQLITE_OS_WIN */ |