| Index: third_party/sqlite/src/src/os.c
|
| diff --git a/third_party/sqlite/src/src/os.c b/third_party/sqlite/src/src/os.c
|
| index 942072159ee1b07710f6244ef29b44d3e19a3290..ba0438adef021ee3e0f5de840e3373390a0da611 100644
|
| --- a/third_party/sqlite/src/src/os.c
|
| +++ b/third_party/sqlite/src/src/os.c
|
| @@ -12,8 +12,6 @@
|
| **
|
| ** This file contains OS interface code that is common to all
|
| ** architectures.
|
| -**
|
| -** $Id: os.c,v 1.127 2009/07/27 11:41:21 danielk1977 Exp $
|
| */
|
| #define _SQLITE_OS_C_ 1
|
| #include "sqliteInt.h"
|
| @@ -36,8 +34,10 @@
|
| ** sqlite3OsLock()
|
| **
|
| */
|
| -#if defined(SQLITE_TEST) && (SQLITE_OS_WIN==0)
|
| - #define DO_OS_MALLOC_TEST(x) if (!x || !sqlite3IsMemJournal(x)) { \
|
| +#if defined(SQLITE_TEST)
|
| +int sqlite3_memdebug_vfs_oom_test = 1;
|
| + #define DO_OS_MALLOC_TEST(x) \
|
| + if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3IsMemJournal(x))) { \
|
| void *pTstAlloc = sqlite3Malloc(10); \
|
| if (!pTstAlloc) return SQLITE_IOERR_NOMEM; \
|
| sqlite3_free(pTstAlloc); \
|
| @@ -100,6 +100,24 @@ int sqlite3OsSectorSize(sqlite3_file *id){
|
| int sqlite3OsDeviceCharacteristics(sqlite3_file *id){
|
| return id->pMethods->xDeviceCharacteristics(id);
|
| }
|
| +int sqlite3OsShmLock(sqlite3_file *id, int offset, int n, int flags){
|
| + return id->pMethods->xShmLock(id, offset, n, flags);
|
| +}
|
| +void sqlite3OsShmBarrier(sqlite3_file *id){
|
| + id->pMethods->xShmBarrier(id);
|
| +}
|
| +int sqlite3OsShmUnmap(sqlite3_file *id, int deleteFlag){
|
| + return id->pMethods->xShmUnmap(id, deleteFlag);
|
| +}
|
| +int sqlite3OsShmMap(
|
| + sqlite3_file *id, /* Database file handle */
|
| + int iPage,
|
| + int pgsz,
|
| + int bExtend, /* True to extend file if necessary */
|
| + void volatile **pp /* OUT: Pointer to mapping */
|
| +){
|
| + return id->pMethods->xShmMap(id, iPage, pgsz, bExtend, pp);
|
| +}
|
|
|
| /*
|
| ** The next group of routines are convenience wrappers around the
|
| @@ -114,11 +132,11 @@ int sqlite3OsOpen(
|
| ){
|
| int rc;
|
| DO_OS_MALLOC_TEST(0);
|
| - /* 0x7f1f is a mask of SQLITE_OPEN_ flags that are valid to be passed
|
| + /* 0x87f3f is a mask of SQLITE_OPEN_ flags that are valid to be passed
|
| ** down into the VFS layer. Some SQLITE_OPEN_ flags (for example,
|
| ** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before
|
| ** reaching the VFS. */
|
| - rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x7f1f, pFlagsOut);
|
| + rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x87f3f, pFlagsOut);
|
| assert( rc==SQLITE_OK || pFile->pMethods==0 );
|
| return rc;
|
| }
|
| @@ -140,6 +158,7 @@ int sqlite3OsFullPathname(
|
| int nPathOut,
|
| char *zPathOut
|
| ){
|
| + zPathOut[0] = 0;
|
| return pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut);
|
| }
|
| #ifndef SQLITE_OMIT_LOAD_EXTENSION
|
| @@ -162,8 +181,22 @@ int sqlite3OsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
|
| int sqlite3OsSleep(sqlite3_vfs *pVfs, int nMicro){
|
| return pVfs->xSleep(pVfs, nMicro);
|
| }
|
| -int sqlite3OsCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
|
| - return pVfs->xCurrentTime(pVfs, pTimeOut);
|
| +int sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){
|
| + int rc;
|
| + /* IMPLEMENTATION-OF: R-49045-42493 SQLite will use the xCurrentTimeInt64()
|
| + ** method to get the current date and time if that method is available
|
| + ** (if iVersion is 2 or greater and the function pointer is not NULL) and
|
| + ** will fall back to xCurrentTime() if xCurrentTimeInt64() is
|
| + ** unavailable.
|
| + */
|
| + if( pVfs->iVersion>=2 && pVfs->xCurrentTimeInt64 ){
|
| + rc = pVfs->xCurrentTimeInt64(pVfs, pTimeOut);
|
| + }else{
|
| + double r;
|
| + rc = pVfs->xCurrentTime(pVfs, &r);
|
| + *pTimeOut = (sqlite3_int64)(r*86400000.0);
|
| + }
|
| + return rc;
|
| }
|
|
|
| int sqlite3OsOpenMalloc(
|
|
|