diff options
author | drh <drh@noemail.net> | 2010-04-27 11:49:27 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2010-04-27 11:49:27 +0000 |
commit | af75c8695bd53883e57affaf6eac7c50743d4f2a (patch) | |
tree | 276df9964b1ab34372906e3f9afd689705dcc18a /src | |
parent | e106de6317e46efdde1b0d38c2b66f16768706ce (diff) | |
download | sqlite-af75c8695bd53883e57affaf6eac7c50743d4f2a.tar.gz sqlite-af75c8695bd53883e57affaf6eac7c50743d4f2a.zip |
Add the xShmRelease() method to the VFS. The os_unix.c implementation of
the shared memory logic is still non-functional.
FossilOrigin-Name: ed715b47c5f7657fbf901805981867898054b14d
Diffstat (limited to 'src')
-rw-r--r-- | src/os_os2.c | 11 | ||||
-rw-r--r-- | src/os_unix.c | 18 | ||||
-rw-r--r-- | src/os_win.c | 11 | ||||
-rw-r--r-- | src/sqlite.h.in | 3 | ||||
-rw-r--r-- | src/test6.c | 9 | ||||
-rw-r--r-- | src/test_demovfs.c | 9 | ||||
-rw-r--r-- | src/test_devsym.c | 9 | ||||
-rw-r--r-- | src/test_journal.c | 9 | ||||
-rw-r--r-- | src/test_osinst.c | 9 |
9 files changed, 20 insertions, 68 deletions
diff --git a/src/os_os2.c b/src/os_os2.c index 04b6dce0e..1c55e4be6 100644 --- a/src/os_os2.c +++ b/src/os_os2.c @@ -1111,16 +1111,7 @@ int sqlite3_os_init(void){ os2Randomness, /* xRandomness */ os2Sleep, /* xSleep */ os2CurrentTime, /* xCurrentTime */ - os2GetLastError /* xGetLastError */ - 0, /* xShmOpen */ - 0, /* xShmSize */ - 0, /* xShmPush */ - 0, /* xShmPull */ - 0, /* xShmLock */ - 0, /* xShmClose */ - 0, /* xShmDelete */ - 0, /* xRename */ - 0, /* xCurrentTimeInt64 */ + os2GetLastError, /* xGetLastError */ }; sqlite3_vfs_register(&os2Vfs, 1); initUconvObjects(); diff --git a/src/os_unix.c b/src/os_unix.c index b2cf9be76..d603caa0d 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4647,8 +4647,13 @@ shm_open_err: ** Query and/or changes the size of a shared-memory segment. ** The reqSize parameter is the new size of the segment, or -1 to ** do just a query. The size of the segment after resizing is -** written into pNewSize. The start of the shared memory buffer -** is stored in **ppBuffer. +** written into pNewSize. A writer lock is held on the shared memory +** segment while resizing it. +** +** If ppBuffer is not NULL, the a reader lock is acquired no the shared +** memory segment and *ppBuffer is made to point to the start of the +** shared memory segment. xShmRelease() must be called to release the +** lock. */ static int unixShmSize( sqlite3_shm *pSharedMem, /* Pointer returned by unixShmOpen() */ @@ -4680,6 +4685,14 @@ static int unixShmSize( } /* +** Release the lock held on the shared memory segment to that other +** threads are free to resize it if necessary. +*/ +static int unixShmRelease(sqlite3_shm *pSharedMem){ + return SQLITE_OK; +} + +/* ** Create or release a lock on shared memory. */ static int unixShmLock( @@ -5934,6 +5947,7 @@ int sqlite3_os_init(void){ unixGetLastError, /* xGetLastError */ \ unixShmOpen, /* xShmOpen */ \ unixShmSize, /* xShmSize */ \ + unixShmRelease, /* xShmRelease */ \ 0, /* xShmPush */ \ 0, /* xShmPull */ \ unixShmLock, /* xShmLock */ \ diff --git a/src/os_win.c b/src/os_win.c index 31c3cffce..cfcf49e36 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1912,16 +1912,7 @@ int sqlite3_os_init(void){ winRandomness, /* xRandomness */ winSleep, /* xSleep */ winCurrentTime, /* xCurrentTime */ - winGetLastError /* xGetLastError */ - 0, /* xShmOpen */ - 0, /* xShmSize */ - 0, /* xShmPush */ - 0, /* xShmPull */ - 0, /* xShmLock */ - 0, /* xShmClose */ - 0, /* xShmDelete */ - 0, /* xRename */ - 0, /* xCurrentTimeInt64 */ + winGetLastError, /* xGetLastError */ }; sqlite3_vfs_register(&winVfs, 1); diff --git a/src/sqlite.h.in b/src/sqlite.h.in index f673781e0..7bc750944 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -844,7 +844,8 @@ struct sqlite3_vfs { ** definition. Those that follow are added in version 2 or later */ int (*xShmOpen)(sqlite3_vfs*, const char *zName, sqlite3_shm**); - int (*xShmSize)(sqlite3_shm*, int reqSize, int *pNewSize, char **); + int (*xShmSize)(sqlite3_shm*, int reqSize, int *pNewSize, char**); + int (*xShmRelease)(sqlite3_shm*); int (*xShmPush)(sqlite3_shm*); int (*xShmPull)(sqlite3_shm*); int (*xShmLock)(sqlite3_shm*, int lockType, int ofst, int nByte); diff --git a/src/test6.c b/src/test6.c index a6e995451..3da9502fd 100644 --- a/src/test6.c +++ b/src/test6.c @@ -782,15 +782,6 @@ static int crashEnableCmd( cfRandomness, /* xRandomness */ cfSleep, /* xSleep */ cfCurrentTime, /* xCurrentTime */ - 0, /* xShmOpen */ - 0, /* xShmSize */ - 0, /* xShmPush */ - 0, /* xShmPull */ - 0, /* xShmLock */ - 0, /* xShmClose */ - 0, /* xShmDelete */ - 0, /* xRename */ - 0 /* xCurrentTimeInt64 */ }; if( objc!=2 ){ diff --git a/src/test_demovfs.c b/src/test_demovfs.c index d91a389db..7cdae8067 100644 --- a/src/test_demovfs.c +++ b/src/test_demovfs.c @@ -624,15 +624,6 @@ sqlite3_vfs *sqlite3_demovfs(void){ demoRandomness, /* xRandomness */ demoSleep, /* xSleep */ demoCurrentTime, /* xCurrentTime */ - 0, /* xShmOpen */ - 0, /* xShmSize */ - 0, /* xShmPush */ - 0, /* xShmPull */ - 0, /* xShmLock */ - 0, /* xShmClose */ - 0, /* xShmDelete */ - 0, /* xRename */ - 0 /* xCurrentTimeInt64 */ }; return &demovfs; } diff --git a/src/test_devsym.c b/src/test_devsym.c index 4249573aa..9f7153804 100644 --- a/src/test_devsym.c +++ b/src/test_devsym.c @@ -93,15 +93,6 @@ static sqlite3_vfs devsym_vfs = { devsymRandomness, /* xRandomness */ devsymSleep, /* xSleep */ devsymCurrentTime, /* xCurrentTime */ - 0, /* xShmOpen */ - 0, /* xShmSize */ - 0, /* xShmPush */ - 0, /* xShmPull */ - 0, /* xShmLock */ - 0, /* xShmClose */ - 0, /* xShmDelete */ - 0, /* xRename */ - 0 /* xCurrentTimeInt64 */ }; static sqlite3_io_methods devsym_io_methods = { diff --git a/src/test_journal.c b/src/test_journal.c index fcfe778d1..020b41575 100644 --- a/src/test_journal.c +++ b/src/test_journal.c @@ -180,15 +180,6 @@ static sqlite3_vfs jt_vfs = { jtRandomness, /* xRandomness */ jtSleep, /* xSleep */ jtCurrentTime, /* xCurrentTime */ - 0, /* xShmOpen */ - 0, /* xShmSize */ - 0, /* xShmPush */ - 0, /* xShmPull */ - 0, /* xShmLock */ - 0, /* xShmClose */ - 0, /* xShmDelete */ - 0, /* xRename */ - 0 /* xCurrentTimeInt64 */ }; static sqlite3_io_methods jt_io_methods = { diff --git a/src/test_osinst.c b/src/test_osinst.c index c6d16aa67..365da38d8 100644 --- a/src/test_osinst.c +++ b/src/test_osinst.c @@ -204,15 +204,6 @@ static sqlite3_vfs inst_vfs = { instRandomness, /* xRandomness */ instSleep, /* xSleep */ instCurrentTime, /* xCurrentTime */ - 0, /* xShmOpen */ - 0, /* xShmSize */ - 0, /* xShmPush */ - 0, /* xShmPull */ - 0, /* xShmLock */ - 0, /* xShmClose */ - 0, /* xShmDelete */ - 0, /* xRename */ - 0 /* xCurrentTimeInt64 */ }; static sqlite3_io_methods inst_io_methods = { |