1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Add additional VFS methods to retrieve system call pointers and to get a

list of all changeable system calls.

FossilOrigin-Name: 38558363494e3a736dcb091dd859e76b7ccd78b0
This commit is contained in:
drh
2011-03-02 19:06:42 +00:00
parent e562be52cf
commit 1df30967af
5 changed files with 58 additions and 16 deletions

View File

@@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE----- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 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. C Add\sadditional\sVFS\smethods\sto\sretrieve\ssystem\scall\spointers\sand\sto\sget\sa\nlist\sof\sall\schangeable\ssystem\scalls.
D 2011-03-02T18:01:10.609 D 2011-03-02T19:06:42.724
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 27701a1653595a1f2187dc61c8117e00a6c1d50f F Makefile.in 27701a1653595a1f2187dc61c8117e00a6c1d50f
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -165,8 +165,8 @@ F src/os.c 22ac61d06e72a0dac900400147333b07b13d8e1d
F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 2e452c9f2ca507623ad351c33a8a8b27849b1863 F src/os_os2.c 2e452c9f2ca507623ad351c33a8a8b27849b1863
F src/os_unix.c a13aa2394c337a51f818b33e8abb5922bcd25cbb F src/os_unix.c 3d38767952d504486d182dea7b77279688011896
F src/os_win.c c2df806a8510ec8c2c2c30fb78b3a25bc1b2f325 F src/os_win.c 24d72407a90551969744cf9bcbb1b4c72c5fa845
F src/pager.c 6aa906b60a59664ba58d3f746164bb010d407ce1 F src/pager.c 6aa906b60a59664ba58d3f746164bb010d407ce1
F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
@@ -181,7 +181,7 @@ F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
F src/select.c d24406c45dd2442eb2eeaac413439066b149c944 F src/select.c d24406c45dd2442eb2eeaac413439066b149c944
F src/shell.c 649c51979812f77f97507024a4cea480c6862b8b F src/shell.c 649c51979812f77f97507024a4cea480c6862b8b
F src/sqlite.h.in a2115e725e77ea1284a4df51b39f94121f020ab8 F src/sqlite.h.in 660a7db4b052f0e390842fcaae49e3de5e10194d
F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754
F src/sqliteInt.h 4290fff17fabc6e07fc4338233df0e39e6350ca1 F src/sqliteInt.h 4290fff17fabc6e07fc4338233df0e39e6350ca1
F src/sqliteLimit.h a17dcd3fb775d63b64a43a55c54cb282f9726f44 F src/sqliteLimit.h a17dcd3fb775d63b64a43a55c54cb282f9726f44
@@ -913,14 +913,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 92b5a76abc53290e1bb87b6b55bc64bb1b331dfc ec55e8c6bb4f2419b3813aa2fd1a20d8f5016159 P 80fac2a6e07221bb67613af84ab9dda3e18b5ceb
R 3565d6dc7b759fbd44b8dfd37d76ad07 R 469544ed72ad6cc0fd2ce66bb41ae458
U drh U drh
Z d880c71a14ae5250c2798782141ecbce Z 4fd425550526c290567641a06db348a6
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux) Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFNboXpoxKgR168RlERAi5qAJ48oWmqxPjfRV4pFj4iAbQCs6u9fQCeNLi2 iD8DBQFNbpVGoxKgR168RlERAiVlAJ9CbY/F1l/3wLXTOWVbVMt3PK4e2wCfXCEX
M/sSIPhA4/GCd6qHTyrGyKQ= gkP0SmX/m93Upo7bU9m9XaA=
=Ttvh =DBkJ
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----

View File

@@ -1 +1 @@
80fac2a6e07221bb67613af84ab9dda3e18b5ceb 38558363494e3a736dcb091dd859e76b7ccd78b0

View File

@@ -376,7 +376,9 @@ static struct unix_syscall {
/* /*
** This is the xSetSystemCall() method of sqlite3_vfs for all of the ** 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( static int unixSetSystemCall(
sqlite3_vfs *pNotUsed, /* The VFS pointer. Not used */ sqlite3_vfs *pNotUsed, /* The VFS pointer. Not used */
@@ -384,7 +386,7 @@ static int unixSetSystemCall(
void *pNewFunc /* Pointer to new system call value */ void *pNewFunc /* Pointer to new system call value */
){ ){
int i; int i;
int rc = 0; int rc = SQLITE_NOTFOUND;
if( zName==0 ){ if( zName==0 ){
/* If no zName is given, restore all system calls to their default /* If no zName is given, restore all system calls to their default
** settings and return NULL ** settings and return NULL
@@ -392,7 +394,7 @@ static int unixSetSystemCall(
for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){ for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
if( aSyscall[i].pDefault ){ if( aSyscall[i].pDefault ){
aSyscall[i].pCurrent = aSyscall[i].pDefault; aSyscall[i].pCurrent = aSyscall[i].pDefault;
rc = 1; rc = SQLITE_OK;
} }
} }
}else{ }else{
@@ -404,7 +406,7 @@ static int unixSetSystemCall(
if( aSyscall[i].pDefault==0 ){ if( aSyscall[i].pDefault==0 ){
aSyscall[i].pDefault = aSyscall[i].pCurrent; aSyscall[i].pDefault = aSyscall[i].pCurrent;
} }
rc = 1; rc = SQLITE_OK;
if( pNewFunc==0 ) pNewFunc = aSyscall[i].pDefault; if( pNewFunc==0 ) pNewFunc = aSyscall[i].pDefault;
aSyscall[i].pCurrent = pNewFunc; aSyscall[i].pCurrent = pNewFunc;
break; break;
@@ -414,6 +416,40 @@ static int unixSetSystemCall(
return rc; 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 ** Helper functions to obtain and relinquish the global mutex. The
@@ -6497,6 +6533,8 @@ int sqlite3_os_init(void){
unixGetLastError, /* xGetLastError */ \ unixGetLastError, /* xGetLastError */ \
unixCurrentTimeInt64, /* xCurrentTimeInt64 */ \ unixCurrentTimeInt64, /* xCurrentTimeInt64 */ \
unixSetSystemCall, /* xSetSystemCall */ \ unixSetSystemCall, /* xSetSystemCall */ \
unixGetSystemCall, /* xGetSystemCall */ \
unixNextSystemCall, /* xNextSystemCall */ \
} }
/* /*

View File

@@ -2766,6 +2766,8 @@ int sqlite3_os_init(void){
winGetLastError, /* xGetLastError */ winGetLastError, /* xGetLastError */
winCurrentTimeInt64, /* xCurrentTimeInt64 */ winCurrentTimeInt64, /* xCurrentTimeInt64 */
0, /* xSetSystemCall */ 0, /* xSetSystemCall */
0, /* xGetSystemCall */
0, /* xNextSystemCall */
}; };
#ifndef SQLITE_OMIT_WAL #ifndef SQLITE_OMIT_WAL

View File

@@ -925,6 +925,8 @@ struct sqlite3_vfs {
** Those below are for version 3 and greater. ** Those below are for version 3 and greater.
*/ */
int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, void *pFunc); 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. ** The methods above are in versions 1 through 3 of the sqlite_vfs object.
** New fields may be appended in figure versions. The iVersion ** New fields may be appended in figure versions. The iVersion