/ Check-in [ea09ff37]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update the crash-test VFS in test6.c to pass-through the shared-memory methods to the real underlying VFS. This fixes the walcrash.test script.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ea09ff37911376505e8262ee9841224995b696f2
User & Date: drh 2010-05-03 16:36:56
Context
2010-05-03
17:18
Fix a couple of errors in WAL code that can occur in an OOM situation. check-in: 9d3f3736 user: dan tags: trunk
16:36
Update the crash-test VFS in test6.c to pass-through the shared-memory methods to the real underlying VFS. This fixes the walcrash.test script. check-in: ea09ff37 user: drh tags: trunk
16:30
Change the VFS definition so that all methods take a VFS object pointer as their first parameter. check-in: 43b5b07f user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/test6.c.

653
654
655
656
657
658
659



























660
661
662
663
664
665
666
...
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
...
778
779
780
781
782
783
784









785
786
787
788
789
790
791
...
798
799
800
801
802
803
804





805
806
807
808
809
810
811
  sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
  return pVfs->xSleep(pVfs, nMicro);
}
static int cfCurrentTime(sqlite3_vfs *pCfVfs, double *pTimeOut){
  sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
  return pVfs->xCurrentTime(pVfs, pTimeOut);
}




























static int processDevSymArgs(
  Tcl_Interp *interp,
  int objc,
  Tcl_Obj *CONST objv[],
  int *piDeviceChar,
  int *piSectorSize
................................................................................
  void * clientData,
  Tcl_Interp *interp,
  int objc,
  Tcl_Obj *CONST objv[]
){
  int isEnable;
  static sqlite3_vfs crashVfs = {
    1,                  /* iVersion */
    0,                  /* szOsFile */
    0,                  /* mxPathname */
    0,                  /* pNext */
    "crash",            /* zName */
    0,                  /* pAppData */
  
    cfOpen,               /* xOpen */
................................................................................
    cfDlOpen,             /* xDlOpen */
    cfDlError,            /* xDlError */
    cfDlSym,              /* xDlSym */
    cfDlClose,            /* xDlClose */
    cfRandomness,         /* xRandomness */
    cfSleep,              /* xSleep */
    cfCurrentTime,        /* xCurrentTime */









  };

  if( objc!=2 ){
    Tcl_WrongNumArgs(interp, 1, objv, "ENABLE");
    return TCL_ERROR;
  }

................................................................................
  }

  if( crashVfs.pAppData==0 ){
    sqlite3_vfs *pOriginalVfs = sqlite3_vfs_find(0);
    crashVfs.mxPathname = pOriginalVfs->mxPathname;
    crashVfs.pAppData = (void *)pOriginalVfs;
    crashVfs.szOsFile = sizeof(CrashFile) + pOriginalVfs->szOsFile;





    sqlite3_vfs_register(&crashVfs, 0);
  }else{
    crashVfs.pAppData = 0;
    sqlite3_vfs_unregister(&crashVfs);
  }

  return TCL_OK;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







 







>
>
>
>
>
>
>
>
>







 







>
>
>
>
>







653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
...
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
...
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
...
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
  sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
  return pVfs->xSleep(pVfs, nMicro);
}
static int cfCurrentTime(sqlite3_vfs *pCfVfs, double *pTimeOut){
  sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
  return pVfs->xCurrentTime(pVfs, pTimeOut);
}
static int cfShmOpen(sqlite3_vfs *pCfVfs, const char *zName, sqlite3_shm **pp){
  sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
  return pVfs->xShmOpen(pVfs, zName, pp);
}
static int cfShmSize(sqlite3_vfs *pCfVfs, sqlite3_shm *p,
                     int reqSize, int *pNew){
  sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
  return pVfs->xShmSize(pVfs, p, reqSize, pNew);
}
static int cfShmGet(sqlite3_vfs *pCfVfs, sqlite3_shm *p,
                    int reqSize, int *pSize, void **pp){
  sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
  return pVfs->xShmGet(pVfs, p, reqSize, pSize, pp);
}
static int cfShmRelease(sqlite3_vfs *pCfVfs, sqlite3_shm *p){
  sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
  return pVfs->xShmRelease(pVfs, p);
}
static int cfShmLock(sqlite3_vfs *pCfVfs, sqlite3_shm *p,
                     int desiredLock, int *gotLock){
  sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
  return pVfs->xShmLock(pVfs, p, desiredLock, gotLock);
}
static int cfShmClose(sqlite3_vfs *pCfVfs, sqlite3_shm *p, int delFlag){
  sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
  return pVfs->xShmClose(pVfs, p, delFlag);
}

static int processDevSymArgs(
  Tcl_Interp *interp,
  int objc,
  Tcl_Obj *CONST objv[],
  int *piDeviceChar,
  int *piSectorSize
................................................................................
  void * clientData,
  Tcl_Interp *interp,
  int objc,
  Tcl_Obj *CONST objv[]
){
  int isEnable;
  static sqlite3_vfs crashVfs = {
    2,                  /* iVersion */
    0,                  /* szOsFile */
    0,                  /* mxPathname */
    0,                  /* pNext */
    "crash",            /* zName */
    0,                  /* pAppData */
  
    cfOpen,               /* xOpen */
................................................................................
    cfDlOpen,             /* xDlOpen */
    cfDlError,            /* xDlError */
    cfDlSym,              /* xDlSym */
    cfDlClose,            /* xDlClose */
    cfRandomness,         /* xRandomness */
    cfSleep,              /* xSleep */
    cfCurrentTime,        /* xCurrentTime */
    0,                    /* xGetlastError */
    cfShmOpen,            /* xShmOpen */
    cfShmSize,            /* xShmSize */
    cfShmGet,             /* xShmGet */
    cfShmRelease,         /* xShmRelease */
    cfShmLock,            /* xShmLock */
    cfShmClose,           /* xShmClose */
    0,                    /* xRename */
    0,                    /* xCurrentTimeInt64 */
  };

  if( objc!=2 ){
    Tcl_WrongNumArgs(interp, 1, objv, "ENABLE");
    return TCL_ERROR;
  }

................................................................................
  }

  if( crashVfs.pAppData==0 ){
    sqlite3_vfs *pOriginalVfs = sqlite3_vfs_find(0);
    crashVfs.mxPathname = pOriginalVfs->mxPathname;
    crashVfs.pAppData = (void *)pOriginalVfs;
    crashVfs.szOsFile = sizeof(CrashFile) + pOriginalVfs->szOsFile;
    if( pOriginalVfs->iVersion<2 || pOriginalVfs->xShmOpen==0 ){
      crashVfs.xShmOpen = 0;
    }else{
      crashVfs.xShmOpen = cfShmOpen;
    }
    sqlite3_vfs_register(&crashVfs, 0);
  }else{
    crashVfs.pAppData = 0;
    sqlite3_vfs_unregister(&crashVfs);
  }

  return TCL_OK;