diff options
| author | Hans-Christoph Steiner <hans@eds.org> | 2012-09-20 18:34:42 -0400 | 
|---|---|---|
| committer | Hans-Christoph Steiner <hans@eds.org> | 2012-09-20 18:34:42 -0400 | 
| commit | 734b4f890763e4efafe865ba476c43cc8d1a2214 (patch) | |
| tree | d561d2fad0788619f4b8e230073f6af1d416934e /src/os.c | |
| parent | 396b08286e7bb56e0e6440aaf1345c18e72ee22e (diff) | |
| parent | 487e15dc239ccdb3344d1c99ce120e872bab4a74 (diff) | |
Merge tag 'upstream/2.0.6'
Upstream version 2.0.6
Diffstat (limited to 'src/os.c')
| -rw-r--r-- | src/os.c | 29 | 
1 files changed, 27 insertions, 2 deletions
| @@ -27,11 +27,18 @@  ** The following functions are instrumented for malloc() failure   ** testing:  ** -**     sqlite3OsOpen()  **     sqlite3OsRead()  **     sqlite3OsWrite()  **     sqlite3OsSync() +**     sqlite3OsFileSize()  **     sqlite3OsLock() +**     sqlite3OsCheckReservedLock() +**     sqlite3OsFileControl() +**     sqlite3OsShmMap() +**     sqlite3OsOpen() +**     sqlite3OsDelete() +**     sqlite3OsAccess() +**     sqlite3OsFullPathname()  **  */  #if defined(SQLITE_TEST) @@ -90,9 +97,23 @@ int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut){    DO_OS_MALLOC_TEST(id);    return id->pMethods->xCheckReservedLock(id, pResOut);  } + +/* +** Use sqlite3OsFileControl() when we are doing something that might fail +** and we need to know about the failures.  Use sqlite3OsFileControlHint() +** when simply tossing information over the wall to the VFS and we do not +** really care if the VFS receives and understands the information since it +** is only a hint and can be safely ignored.  The sqlite3OsFileControlHint() +** routine has no return value since the return value would be meaningless. +*/  int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){ +  DO_OS_MALLOC_TEST(id);    return id->pMethods->xFileControl(id, op, pArg);  } +void sqlite3OsFileControlHint(sqlite3_file *id, int op, void *pArg){ +  (void)id->pMethods->xFileControl(id, op, pArg); +} +  int sqlite3OsSectorSize(sqlite3_file *id){    int (*xSectorSize)(sqlite3_file*) = id->pMethods->xSectorSize;    return (xSectorSize ? xSectorSize(id) : SQLITE_DEFAULT_SECTOR_SIZE); @@ -116,6 +137,7 @@ int sqlite3OsShmMap(    int bExtend,                    /* True to extend file if necessary */    void volatile **pp              /* OUT: Pointer to mapping */  ){ +  DO_OS_MALLOC_TEST(id);    return id->pMethods->xShmMap(id, iPage, pgsz, bExtend, pp);  } @@ -132,7 +154,7 @@ int sqlite3OsOpen(  ){    int rc;    DO_OS_MALLOC_TEST(0); -  /* 0x87f3f is a mask of SQLITE_OPEN_ flags that are valid to be passed +  /* 0x87f7f 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. */ @@ -141,6 +163,8 @@ int sqlite3OsOpen(    return rc;  }  int sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ +  DO_OS_MALLOC_TEST(0); +  assert( dirSync==0 || dirSync==1 );    return pVfs->xDelete(pVfs, zPath, dirSync);  }  int sqlite3OsAccess( @@ -158,6 +182,7 @@ int sqlite3OsFullPathname(    int nPathOut,     char *zPathOut  ){ +  DO_OS_MALLOC_TEST(0);    zPathOut[0] = 0;    return pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut);  } | 
