/ Check-in [87a9e9d7]
Login

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

Overview
Comment:The file_control_ofd_locks TCL command in testfixture distinguishes between OFD locks unavailable on the platform and OFD locks not used.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | ofd-locks
Files: files | file ages | folders
SHA3-256: 87a9e9d776b6877a687711c1eb0e6ac318eca95dd3a9daae9ba08c2dc486424d
User & Date: drh 2018-06-19 19:16:13
Context
2018-06-19
19:16
The file_control_ofd_locks TCL command in testfixture distinguishes between OFD locks unavailable on the platform and OFD locks not used. Leaf check-in: 87a9e9d7 user: drh tags: ofd-locks
19:01
OFD locks are now mostly working, but need additional tests. check-in: 4f1fb5c9 user: drh tags: ofd-locks
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

3957
3958
3959
3960
3961
3962
3963

3964
3965
3966
3967

3968
3969
3970
3971
3972
3973
3974
    }
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
    case SQLITE_FCNTL_LOCK_TIMEOUT: {
      pFile->iBusyTimeout = *(int*)pArg;
      return SQLITE_OK;
    }
#endif

    case SQLITE_FCNTL_OFD_LOCKS: {
      *(int*)pArg = UsesOfd(pFile);
      return SQLITE_OK;
    }

#if SQLITE_MAX_MMAP_SIZE>0
    case SQLITE_FCNTL_MMAP_SIZE: {
      i64 newLimit = *(i64*)pArg;
      int rc = SQLITE_OK;
      if( newLimit>sqlite3GlobalConfig.mxMmap ){
        newLimit = sqlite3GlobalConfig.mxMmap;
      }







>




>







3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
    }
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
    case SQLITE_FCNTL_LOCK_TIMEOUT: {
      pFile->iBusyTimeout = *(int*)pArg;
      return SQLITE_OK;
    }
#endif
#if HAVE_OFD_LOCKS
    case SQLITE_FCNTL_OFD_LOCKS: {
      *(int*)pArg = UsesOfd(pFile);
      return SQLITE_OK;
    }
#endif
#if SQLITE_MAX_MMAP_SIZE>0
    case SQLITE_FCNTL_MMAP_SIZE: {
      i64 newLimit = *(i64*)pArg;
      int rc = SQLITE_OK;
      if( newLimit>sqlite3GlobalConfig.mxMmap ){
        newLimit = sqlite3GlobalConfig.mxMmap;
      }

Changes to src/test1.c.

5962
5963
5964
5965
5966
5967
5968
5969

5970


5971
5972
5973
5974
5975
5976
5977
5978
5979
5980

5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991







5992
5993
5994
5995
5996
5997
5998
5999
  Tcl_AppendResult(interp, z, (char*)0);
  return TCL_OK;  
}

/*
** tclcmd:   file_control_ofd_locks DB
**
** Run sqlite3_file_control() to query the OFD lock capability.  Return

** true if OFD locks are available and false if not.


*/
static int SQLITE_TCLAPI file_control_ofd_locks(
  ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  int objc,              /* Number of arguments */
  Tcl_Obj *CONST objv[]  /* Command arguments */
){
  sqlite3 *db;
  int rc;
  int b = 0;


  if( objc!=2 ){
    Tcl_AppendResult(interp, "wrong # args: should be \"",
        Tcl_GetStringFromObj(objv[0], 0), " DB", 0);
    return TCL_ERROR;
  }
  if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
    return TCL_ERROR;
  }
  b = 0;
  rc = sqlite3_file_control(db,NULL,SQLITE_FCNTL_OFD_LOCKS,(void*)&b);







  Tcl_AppendResult(interp, (rc==SQLITE_OK && b) ? "1" : "0", (char*)0);
  return TCL_OK;  
}

/*
** tclcmd:   file_control_powersafe_overwrite DB PSOW-FLAG
**
** This TCL command runs the sqlite3_file_control interface with







|
>
|
>
>










>











>
>
>
>
>
>
>
|







5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
  Tcl_AppendResult(interp, z, (char*)0);
  return TCL_OK;  
}

/*
** tclcmd:   file_control_ofd_locks DB
**
** Run sqlite3_file_control() to query the OFD lock capability.  Return:
**
**     2   OFD locks are available and are used on DB
**     1   OFD locks are available but DB is not using them
**     0   OFD locks are not available
*/
static int SQLITE_TCLAPI file_control_ofd_locks(
  ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  int objc,              /* Number of arguments */
  Tcl_Obj *CONST objv[]  /* Command arguments */
){
  sqlite3 *db;
  int rc;
  int b = 0;
  const char *z;

  if( objc!=2 ){
    Tcl_AppendResult(interp, "wrong # args: should be \"",
        Tcl_GetStringFromObj(objv[0], 0), " DB", 0);
    return TCL_ERROR;
  }
  if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
    return TCL_ERROR;
  }
  b = 0;
  rc = sqlite3_file_control(db,NULL,SQLITE_FCNTL_OFD_LOCKS,(void*)&b);
  if( rc!=SQLITE_OK ){
    z = "0";
  }else if( b ){
    z = "2";
  }else{
    z = "1";
  }
  Tcl_AppendResult(interp, z, (char*)0);
  return TCL_OK;  
}

/*
** tclcmd:   file_control_powersafe_overwrite DB PSOW-FLAG
**
** This TCL command runs the sqlite3_file_control interface with