OLD | NEW |
| (Empty) |
1 From 12b0ba774b11ae27c41ad20e62522c00567e2a0a Mon Sep 17 00:00:00 2001 | |
2 From: Scott Hess <shess@chromium.org> | |
3 Date: Wed, 5 Aug 2015 16:44:32 -0700 | |
4 Subject: [PATCH 10/10] Allow read-only memory mapping. | |
5 | |
6 In memory-mapped I/O mode, SQLite writes pages by using memcpy() from | |
7 the staging memory into the underlying memory-mapped file. This allows | |
8 anyone in the process to also write into that space. Modify SQLite to | |
9 map things read-only. | |
10 | |
11 TODO: Upstream. | |
12 | |
13 BUG=489784 | |
14 --- | |
15 third_party/sqlite/src/src/os_unix.c | 2 +- | |
16 third_party/sqlite/src/src/os_win.c | 2 +- | |
17 2 files changed, 2 insertions(+), 2 deletions(-) | |
18 | |
19 diff --git a/third_party/sqlite/src/src/os_unix.c b/third_party/sqlite/src/src/o
s_unix.c | |
20 index fa85638..523cad6 100644 | |
21 --- a/third_party/sqlite/src/src/os_unix.c | |
22 +++ b/third_party/sqlite/src/src/os_unix.c | |
23 @@ -3141,7 +3141,7 @@ static int unixRead( | |
24 ); | |
25 #endif | |
26 | |
27 -#if SQLITE_MAX_MMAP_SIZE>0 | |
28 +#if defined(SQLITE_MMAP_READWRITE) && SQLITE_MAX_MMAP_SIZE>0 | |
29 /* Deal with as much of this read request as possible by transfering | |
30 ** data from the memory mapping using memcpy(). */ | |
31 if( offset<pFile->mmapSize ){ | |
32 diff --git a/third_party/sqlite/src/src/os_win.c b/third_party/sqlite/src/src/os
_win.c | |
33 index 00ad6fd..8a68828 100644 | |
34 --- a/third_party/sqlite/src/src/os_win.c | |
35 +++ b/third_party/sqlite/src/src/os_win.c | |
36 @@ -2524,7 +2524,7 @@ static int winRead( | |
37 "offset=%lld, lock=%d\n", osGetCurrentProcessId(), pFile, | |
38 pFile->h, pBuf, amt, offset, pFile->locktype)); | |
39 | |
40 -#if SQLITE_MAX_MMAP_SIZE>0 | |
41 +#if defined(SQLITE_MMAP_READWRITE) && SQLITE_MAX_MMAP_SIZE>0 | |
42 /* Deal with as much of this read request as possible by transfering | |
43 ** data from the memory mapping using memcpy(). */ | |
44 if( offset<pFile->mmapSize ){ | |
45 -- | |
46 2.7.0 | |
47 | |
OLD | NEW |