aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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 */