]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add additional VFS methods to retrieve system call pointers and to get a
authordrh <drh@noemail.net>
Wed, 2 Mar 2011 19:06:42 +0000 (19:06 +0000)
committerdrh <drh@noemail.net>
Wed, 2 Mar 2011 19:06:42 +0000 (19:06 +0000)
list of all changeable system calls.

FossilOrigin-Name: 38558363494e3a736dcb091dd859e76b7ccd78b0

manifest
manifest.uuid
src/os_unix.c
src/os_win.c
src/sqlite.h.in

index 8febb8aa6730892a4c9e2e1e1311010e59083608..615bc1ff8df266b59dffdacdd1f4ac44501a5f00 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-C Add\smore\ssystem\scalls\sto\sthe\sset\sthat\scan\sbe\soverridden\sin\sos_unix.c.\nAlso\smerge\sin\srecent\sfixes\sfrom\strunk.
-D 2011-03-02T18:01:10.609
+C Add\sadditional\sVFS\smethods\sto\sretrieve\ssystem\scall\spointers\sand\sto\sget\sa\nlist\sof\sall\schangeable\ssystem\scalls.
+D 2011-03-02T19:06:42.724
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 27701a1653595a1f2187dc61c8117e00a6c1d50f
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -165,8 +165,8 @@ F src/os.c 22ac61d06e72a0dac900400147333b07b13d8e1d
 F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
 F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
 F src/os_os2.c 2e452c9f2ca507623ad351c33a8a8b27849b1863
-F src/os_unix.c a13aa2394c337a51f818b33e8abb5922bcd25cbb
-F src/os_win.c c2df806a8510ec8c2c2c30fb78b3a25bc1b2f325
+F src/os_unix.c 3d38767952d504486d182dea7b77279688011896
+F src/os_win.c 24d72407a90551969744cf9bcbb1b4c72c5fa845
 F src/pager.c 6aa906b60a59664ba58d3f746164bb010d407ce1
 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
@@ -181,7 +181,7 @@ F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706
 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
 F src/select.c d24406c45dd2442eb2eeaac413439066b149c944
 F src/shell.c 649c51979812f77f97507024a4cea480c6862b8b
-F src/sqlite.h.in a2115e725e77ea1284a4df51b39f94121f020ab8
+F src/sqlite.h.in 660a7db4b052f0e390842fcaae49e3de5e10194d
 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754
 F src/sqliteInt.h 4290fff17fabc6e07fc4338233df0e39e6350ca1
 F src/sqliteLimit.h a17dcd3fb775d63b64a43a55c54cb282f9726f44
@@ -913,14 +913,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 92b5a76abc53290e1bb87b6b55bc64bb1b331dfc ec55e8c6bb4f2419b3813aa2fd1a20d8f5016159
-R 3565d6dc7b759fbd44b8dfd37d76ad07
+P 80fac2a6e07221bb67613af84ab9dda3e18b5ceb
+R 469544ed72ad6cc0fd2ce66bb41ae458
 U drh
-Z d880c71a14ae5250c2798782141ecbce
+Z 4fd425550526c290567641a06db348a6
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (GNU/Linux)
 
-iD8DBQFNboXpoxKgR168RlERAi5qAJ48oWmqxPjfRV4pFj4iAbQCs6u9fQCeNLi2
-M/sSIPhA4/GCd6qHTyrGyKQ=
-=Ttvh
+iD8DBQFNbpVGoxKgR168RlERAiVlAJ9CbY/F1l/3wLXTOWVbVMt3PK4e2wCfXCEX
+gkP0SmX/m93Upo7bU9m9XaA=
+=DBkJ
 -----END PGP SIGNATURE-----
index 3647910982fe63b8996a1fe4b648b875d4af4883..0f06d09f05876a6160b5dc6ab7a4a310ee5e0f8d 100644 (file)
@@ -1 +1 @@
-80fac2a6e07221bb67613af84ab9dda3e18b5ceb
\ No newline at end of file
+38558363494e3a736dcb091dd859e76b7ccd78b0
\ No newline at end of file
index 18ec658701d28e619e9b2d6f0ea53e4cf9acd619..c5261bb1117f2e556162d5dc0cea1e79cae47656 100644 (file)
@@ -376,7 +376,9 @@ static struct unix_syscall {
 
 /*
 ** This is the xSetSystemCall() method of sqlite3_vfs for all of the
-** "unix" VFSes.
+** "unix" VFSes.  Return SQLITE_OK opon successfully updating the
+** system call pointer, or SQLITE_NOTFOUND if there is no configurable
+** system call named zName.
 */
 static int unixSetSystemCall(
   sqlite3_vfs *pNotUsed,     /* The VFS pointer.  Not used */
@@ -384,7 +386,7 @@ static int unixSetSystemCall(
   void *pNewFunc             /* Pointer to new system call value */
 ){
   int i;
-  int rc = 0;
+  int rc = SQLITE_NOTFOUND;
   if( zName==0 ){
     /* If no zName is given, restore all system calls to their default
     ** settings and return NULL
@@ -392,7 +394,7 @@ static int unixSetSystemCall(
     for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
       if( aSyscall[i].pDefault ){
         aSyscall[i].pCurrent = aSyscall[i].pDefault;
-        rc = 1;
+        rc = SQLITE_OK;
       }
     }
   }else{
@@ -404,7 +406,7 @@ static int unixSetSystemCall(
         if( aSyscall[i].pDefault==0 ){
           aSyscall[i].pDefault = aSyscall[i].pCurrent;
         }
-        rc = 1;
+        rc = SQLITE_OK;
         if( pNewFunc==0 ) pNewFunc = aSyscall[i].pDefault;
         aSyscall[i].pCurrent = pNewFunc;
         break;
@@ -414,6 +416,40 @@ static int unixSetSystemCall(
   return rc;
 }
 
+/*
+** Return the value of a system call.  Return NULL if zName is not a
+** recognized system call name.  NULL is also returned if the system call
+** is currently undefined.
+*/
+static void *unixGetSystemCall(sqlite3_vfs *pNotUsed, const char *zName){
+  int i;
+  for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
+    if( strcmp(zName, aSyscall[i].zName)==0 ) return aSyscall[i].pCurrent;
+  }
+  return 0;
+}
+
+/*
+** Return the name of the first system call after zName.  If zName==NULL
+** then return the name of the first system call.  Return NULL if zName
+** is the last system call or if zName is not the name of a valid
+** system call.
+*/
+static const char *unixNextSystemCall(sqlite3_vfs *p, const char *zName){
+  int i;
+  if( zName==0 ){
+    i = -1;
+  }else{
+    for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0])-1; i++){
+      if( strcmp(zName, aSyscall[0].zName)==0 ) break;
+    }
+  }
+  for(i++; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
+    if( aSyscall[0].pCurrent!=0 ) return aSyscall[0].zName;
+  }
+  return 0;
+}
+
 
 /*
 ** Helper functions to obtain and relinquish the global mutex. The
@@ -6497,6 +6533,8 @@ int sqlite3_os_init(void){
     unixGetLastError,     /* xGetLastError */               \
     unixCurrentTimeInt64, /* xCurrentTimeInt64 */           \
     unixSetSystemCall,    /* xSetSystemCall */              \
+    unixGetSystemCall,    /* xGetSystemCall */              \
+    unixNextSystemCall,   /* xNextSystemCall */             \
   }
 
   /*
index 4d19e57a36ce34e43fd35c1159934af5736ec603..c8768339cda78655806a84cf1ac4412d1eb29ef7 100644 (file)
@@ -2766,6 +2766,8 @@ int sqlite3_os_init(void){
     winGetLastError,     /* xGetLastError */
     winCurrentTimeInt64, /* xCurrentTimeInt64 */
     0,                   /* xSetSystemCall */
+    0,                   /* xGetSystemCall */
+    0,                   /* xNextSystemCall */
   };
 
 #ifndef SQLITE_OMIT_WAL
index 5c07b8d96af34329971a0888e43a136f02f1d349..e2332466f839d34fdb7cf9223939b0465b6ce47b 100644 (file)
@@ -925,6 +925,8 @@ struct sqlite3_vfs {
   ** Those below are for version 3 and greater.
   */
   int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, void *pFunc);
+  void *(*xGetSystemCall)(sqlite3_vfs*, const char *zName);
+  const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);
   /*
   ** The methods above are in versions 1 through 3 of the sqlite_vfs object.
   ** New fields may be appended in figure versions.  The iVersion