aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2022-09-17 18:29:49 +0000
committerdrh <>2022-09-17 18:29:49 +0000
commit20a9ed1dc6fd63573e49328d27e955969f18470d (patch)
tree145e8de6db93635297c37c867a25b1814e43dd1e /src
parentb9fbc558f797d25d50a32150c8fcedf490f74015 (diff)
downloadsqlite-20a9ed1dc6fd63573e49328d27e955969f18470d.tar.gz
sqlite-20a9ed1dc6fd63573e49328d27e955969f18470d.zip
Include the kv-vfs as an optional VFS on unix builds if the
SQLITE_OS_KV_OPTIONAL compile-time option is present. FossilOrigin-Name: 852812d1e2ec3c53ad7c6c64662b37d861fefcf1baeee3d58eba88bcb3f6d8df
Diffstat (limited to 'src')
-rw-r--r--src/os_kv.c14
-rw-r--r--src/os_unix.c3
-rw-r--r--src/sqliteInt.h4
3 files changed, 18 insertions, 3 deletions
diff --git a/src/os_kv.c b/src/os_kv.c
index db95a305b..c1df1f526 100644
--- a/src/os_kv.c
+++ b/src/os_kv.c
@@ -15,7 +15,7 @@
** text.
*/
#include <sqliteInt.h>
-#if SQLITE_OS_KV
+#if SQLITE_OS_KV || (SQLITE_OS_UNIX && defined(SQLITE_OS_KV_OPTIONAL))
/*****************************************************************************
** Debugging logic
@@ -89,7 +89,7 @@ static int kvvfsSleep(sqlite3_vfs*, int microseconds);
static int kvvfsCurrentTime(sqlite3_vfs*, double*);
static int kvvfsCurrentTimeInt64(sqlite3_vfs*, sqlite3_int64*);
-static sqlite3_vfs kvvfs_vfs = {
+static sqlite3_vfs sqlite3OsKvvfsObject = {
1, /* iVersion */
sizeof(KVVfsFile), /* szOsFile */
1024, /* mxPathname */
@@ -1107,14 +1107,22 @@ static int kvvfsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){
*pTimeOut = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_usec/1000;
return SQLITE_OK;
}
+#endif /* SQLITE_OS_KV || SQLITE_OS_UNIX */
+#if SQLITE_OS_KV
/*
** This routine is called initialize the KV-vfs as the default VFS.
*/
int sqlite3_os_init(void){
- return sqlite3_vfs_register(&kvvfs_vfs, 1);
+ return sqlite3_vfs_register(&sqlite3OsKvvfsObject, 1);
}
int sqlite3_os_end(void){
return SQLITE_OK;
}
#endif /* SQLITE_OS_KV */
+
+#if SQLITE_OS_UNIX && defined(SQLITE_OS_KV_OPTIONAL)
+int sqlite3KvvfsInit(void){
+ return sqlite3_vfs_register(&sqlite3OsKvvfsObject, 0);
+}
+#endif
diff --git a/src/os_unix.c b/src/os_unix.c
index 784686d0a..c390b5188 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -8065,6 +8065,9 @@ int sqlite3_os_init(void){
sqlite3_vfs_register(&aVfs[i], i==0);
#endif
}
+#ifdef SQLITE_OS_KV_OPTIONAL
+ sqlite3KvvfsInit();
+#endif
unixBigLock = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
#ifndef SQLITE_OMIT_WAL
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 63e3583c8..7f1dee6eb 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -5456,4 +5456,8 @@ void sqlite3VectorErrorMsg(Parse*, Expr*);
const char **sqlite3CompileOptions(int *pnOpt);
#endif
+#if SQLITE_OS_UNIX && defined(SQLITE_OS_KV_OPTIONAL)
+int sqlite3KvvfsInit(void);
+#endif
+
#endif /* SQLITEINT_H */