summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Chang <vfcc@google.com>2019-01-18 17:16:37 -0800
committerVictor Chang <vfcc@google.com>2019-03-20 13:56:40 -0700
commit5148bb2b921ee84709d3924aecbad69d77300aff (patch)
treeafe91f4bdabbce45ab54ab2071156252dd39383c
parent66b437d9071f9f8e21eef9d454e24bc6bd6c6093 (diff)
[fuchsia] Add Fuchsia support to SQLite.
This enables basic database locking, but there are known weaknesses to this approach. ie. If the process is killed before the *.lock file can be deleted, then the database is perpetually locked. Bug: 120103808 Test: Database locking works. Merged-In: Iac54c5f76e167fef15b490522840d33808d4bc6c Change-Id: Iac54c5f76e167fef15b490522840d33808d4bc6c
-rw-r--r--dist/Android.bp31
-rw-r--r--dist/Android.patch23
-rw-r--r--dist/sqlite3.c4
3 files changed, 52 insertions, 6 deletions
diff --git a/dist/Android.bp b/dist/Android.bp
index 54cd389..43304a0 100644
--- a/dist/Android.bp
+++ b/dist/Android.bp
@@ -61,6 +61,13 @@ cc_defaults {
"-DHAVE_MALLOC_USABLE_SIZE",
],
},
+ fuchsia: {
+ cflags: [
+ "-Dfdatasync=fdatasync",
+ "-DHAVE_MALLOC_H=1",
+ "-DHAVE_MALLOC_USABLE_SIZE",
+ ],
+ },
},
}
@@ -87,6 +94,18 @@ cc_library {
// include android specific methods
whole_static_libs: ["libsqlite3_android"],
},
+ fuchsia: {
+ shared_libs: [
+ "liblog",
+ "libutils",
+ "libicuuc",
+ "libicui18n",
+ ],
+ cflags: ["-DSQLITE_ENABLE_ICU"],
+
+ // include android specific methods
+ whole_static_libs: ["libsqlite3_android"],
+ },
host: {
static_libs: [
"liblog",
@@ -134,6 +153,18 @@ cc_binary {
"libutils",
],
},
+ fuchsia: {
+ shared_libs: [
+ "libsqlite",
+ "libicuuc",
+ "libicui18n",
+ "liblog",
+ "libutils",
+ ],
+ static_libs: [
+ "libicuandroid_utils",
+ ],
+ },
host: {
cflags: ["-DNO_ANDROID_FUNCS=1"],
static_libs: [
diff --git a/dist/Android.patch b/dist/Android.patch
index 307a832..80873e2 100644
--- a/dist/Android.patch
+++ b/dist/Android.patch
@@ -1,5 +1,5 @@
---- orig/shell.c 2018-04-17 11:53:05.520972146 +0100
-+++ shell.c 2019-03-14 19:26:19.523122555 +0000
+--- orig/shell.c 2018-06-15 18:37:50.651936274 -0700
++++ shell.c 2019-03-18 16:45:23.691937057 -0700
@@ -87,6 +87,12 @@
#endif
#include <ctype.h>
@@ -37,8 +37,8 @@
if( p->openMode==SHELL_OPEN_ZIPFILE ){
char *zSql = sqlite3_mprintf(
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", p->zDbFilename);
---- orig/sqlite3.c 2019-03-11 19:52:44.237549639 +0000
-+++ sqlite3.c 2019-03-11 19:52:44.293549396 +0000
+--- orig/sqlite3.c 2019-03-18 16:45:23.687937080 -0700
++++ sqlite3.c 2019-03-18 16:45:24.723931232 -0700
@@ -30672,6 +30672,10 @@
# include <sys/mount.h>
#endif
@@ -104,7 +104,18 @@
goto shm_open_err;
}
-@@ -118054,7 +118070,7 @@
+@@ -38434,6 +38450,10 @@
+ UNIXVFS("unix", autolockIoFinder ),
+ #elif OS_VXWORKS
+ UNIXVFS("unix", vxworksIoFinder ),
++#elif __Fuchsia__
++ /* None of the system calls for other exclusion methods are currently
++ ** implemented on Fuchsia, so use simple dot-file locking for now. */
++ UNIXVFS("unix", dotlockIoFinder ),
+ #else
+ UNIXVFS("unix", posixIoFinder ),
+ #endif
+@@ -118054,7 +118074,7 @@
}
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
sqlite3SetString(pzErrMsg, db, "unsupported file format");
@@ -113,7 +124,7 @@
goto initone_error_out;
}
-@@ -152769,13 +152785,25 @@
+@@ -152769,13 +152789,25 @@
** module with sqlite.
*/
if( SQLITE_OK==rc
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
index 18b8246..1931481 100644
--- a/dist/sqlite3.c
+++ b/dist/sqlite3.c
@@ -38450,6 +38450,10 @@ SQLITE_API int sqlite3_os_init(void){
UNIXVFS("unix", autolockIoFinder ),
#elif OS_VXWORKS
UNIXVFS("unix", vxworksIoFinder ),
+#elif __Fuchsia__
+ /* None of the system calls for other exclusion methods are currently
+ ** implemented on Fuchsia, so use simple dot-file locking for now. */
+ UNIXVFS("unix", dotlockIoFinder ),
#else
UNIXVFS("unix", posixIoFinder ),
#endif