mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Continuing to refactor os_unix.c. This is an incremental check-in. (CVS 5967)
FossilOrigin-Name: c13df0311ef4f6a510f42105293f7c53c323fda8
This commit is contained in:
18
manifest
18
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Continuing\swork\son\sthe\sos_unix.c\srefactoring.\s\sRemoved\sall\sof\sthe\nLOCKING_STYLE_*\sconstants\sand\sinstead\spass\saround\spointers\sto\sthe\nunderlying\ssqlite3_io_method\sobjects.\s(CVS\s5966)
|
C Continuing\sto\srefactor\sos_unix.c.\s\sThis\sis\san\sincremental\scheck-in.\s(CVS\s5967)
|
||||||
D 2008-11-29T00:56:53
|
D 2008-11-29T02:20:27
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in 0aa7bbe3be6acc4045706e3bb3fd0b8f38f4a3b5
|
F Makefile.in 0aa7bbe3be6acc4045706e3bb3fd0b8f38f4a3b5
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -137,7 +137,7 @@ F src/os.c 0b411644b87ad689d7250bbfd1834d99b81a3df4
|
|||||||
F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892
|
F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892
|
||||||
F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
|
F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
|
||||||
F src/os_os2.c 36196e71292a44bf2d393413cd8c86199694b8b4
|
F src/os_os2.c 36196e71292a44bf2d393413cd8c86199694b8b4
|
||||||
F src/os_unix.c 9c5269d610ec2d43a19733e964e89f3e61323b29
|
F src/os_unix.c a5c0e3fe58b85c81fafd16f8c663c931ba38b364
|
||||||
F src/os_win.c 3dff41670fb9798a869c636626bb7d6d8b6a45bb
|
F src/os_win.c 3dff41670fb9798a869c636626bb7d6d8b6a45bb
|
||||||
F src/pager.c 2e9182e181bbd3d758436d9ccce2a3910400dd30
|
F src/pager.c 2e9182e181bbd3d758436d9ccce2a3910400dd30
|
||||||
F src/pager.h a02ef8e6cc7e78b54874166e5ce786c9d4c489bf
|
F src/pager.h a02ef8e6cc7e78b54874166e5ce786c9d4c489bf
|
||||||
@@ -159,7 +159,7 @@ F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
|
|||||||
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
|
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
|
||||||
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
|
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
|
||||||
F src/tclsqlite.c 96049bd454f1547abff0a57c45f0dfa57701e076
|
F src/tclsqlite.c 96049bd454f1547abff0a57c45f0dfa57701e076
|
||||||
F src/test1.c 737638299302ef85e34f6d04c40d8155db251736
|
F src/test1.c 27a78e2804caf3bc6477615a955ce2dab77b1aa3
|
||||||
F src/test2.c 897528183edf2839c2a3c991d415905db56f1240
|
F src/test2.c 897528183edf2839c2a3c991d415905db56f1240
|
||||||
F src/test3.c 88a246b56b824275300e6c899634fbac1dc94b14
|
F src/test3.c 88a246b56b824275300e6c899634fbac1dc94b14
|
||||||
F src/test4.c f79ab52d27ff49b784b631a42e2ccd52cfd5c84c
|
F src/test4.c f79ab52d27ff49b784b631a42e2ccd52cfd5c84c
|
||||||
@@ -171,7 +171,7 @@ F src/test9.c 904ebe0ed1472d6bad17a81e2ecbfc20017dc237
|
|||||||
F src/test_async.c 45024094ed7cf780c5d5dccda645145f95cf78ef
|
F src/test_async.c 45024094ed7cf780c5d5dccda645145f95cf78ef
|
||||||
F src/test_autoext.c f53b0cdf7bf5f08100009572a5d65cdb540bd0ad
|
F src/test_autoext.c f53b0cdf7bf5f08100009572a5d65cdb540bd0ad
|
||||||
F src/test_btree.c d7b8716544611c323860370ee364e897c861f1b0
|
F src/test_btree.c d7b8716544611c323860370ee364e897c861f1b0
|
||||||
F src/test_config.c 4fcc391cbd5d2334c67cf3ec643c2c2bcc3025fa
|
F src/test_config.c 4f85387a52f3c7966c3ffab913e988a3830fe1af
|
||||||
F src/test_devsym.c 802d10e65b4217208cb47059b84adf46318bcdf4
|
F src/test_devsym.c 802d10e65b4217208cb47059b84adf46318bcdf4
|
||||||
F src/test_func.c a55c4d5479ff2eb5c0a22d4d88e9528ab59c953b
|
F src/test_func.c a55c4d5479ff2eb5c0a22d4d88e9528ab59c953b
|
||||||
F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f
|
F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f
|
||||||
@@ -410,7 +410,7 @@ F test/lock.test a280c87f86cfe25ac8899bd6cdfd23ffc5aca40a
|
|||||||
F test/lock2.test 018b846f6f3b3b695fad07e317b7988442b556f4
|
F test/lock2.test 018b846f6f3b3b695fad07e317b7988442b556f4
|
||||||
F test/lock3.test 8adfbf438b96316267611214d494ebc1311b8cda
|
F test/lock3.test 8adfbf438b96316267611214d494ebc1311b8cda
|
||||||
F test/lock4.test 09d97d52cae18fadfe631552af9880dac6b3ae90
|
F test/lock4.test 09d97d52cae18fadfe631552af9880dac6b3ae90
|
||||||
F test/lock5.test a6eaac62eb14bc125f9cc0c2d06a80009fc67587
|
F test/lock5.test 175e2eb76e0d495c4cf2ffd4f07a62292b6c727f
|
||||||
F test/lock6.test f4e9052b14da3bd6807a757d5aed15c17321031a
|
F test/lock6.test f4e9052b14da3bd6807a757d5aed15c17321031a
|
||||||
F test/lookaside.test e69f822f13745f1d5c445c6e30e30f059f30c8e5
|
F test/lookaside.test e69f822f13745f1d5c445c6e30e30f059f30c8e5
|
||||||
F test/main.test 187a9a1b5248ed74a83838c581c15ec6023b555b
|
F test/main.test 187a9a1b5248ed74a83838c581c15ec6023b555b
|
||||||
@@ -662,7 +662,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
|||||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
P 7825cd63e5cb390a9c2c05957ebc9b189612f04a
|
P 1017d2fb1935a278ef442030bf7bdf5e112c566a
|
||||||
R 2259cba8f622d2dabcb4ffff89e3fb5a
|
R f00e6eb8b99e6b851224a95474513114
|
||||||
U drh
|
U drh
|
||||||
Z 276dfeea88fd39cbd9c4b8d08e052ab2
|
Z f1b7704edc33398e54a65a32044b4ee1
|
||||||
|
@@ -1 +1 @@
|
|||||||
1017d2fb1935a278ef442030bf7bdf5e112c566a
|
c13df0311ef4f6a510f42105293f7c53c323fda8
|
@@ -19,7 +19,7 @@
|
|||||||
** use flock(), dot-files, various proprietary locking schemas, or simply
|
** use flock(), dot-files, various proprietary locking schemas, or simply
|
||||||
** skip locking all together.
|
** skip locking all together.
|
||||||
**
|
**
|
||||||
** This source file is group into divisions where the logic for various
|
** This source file is organized into divisions where the logic for various
|
||||||
** subfunctions is contained within the appropriate division. PLEASE
|
** subfunctions is contained within the appropriate division. PLEASE
|
||||||
** KEEP THE STRUCTURE OF THIS FILE INTACT. New code should be placed
|
** KEEP THE STRUCTURE OF THIS FILE INTACT. New code should be placed
|
||||||
** in the correct division and should be clearly labeled.
|
** in the correct division and should be clearly labeled.
|
||||||
@@ -36,11 +36,14 @@
|
|||||||
** + for named semaphore locks (VxWorks only)
|
** + for named semaphore locks (VxWorks only)
|
||||||
** + for AFP filesystem locks (MacOSX only)
|
** + for AFP filesystem locks (MacOSX only)
|
||||||
** + for proxy locks (MacOSX only)
|
** + for proxy locks (MacOSX only)
|
||||||
** * The routine used to detect an appropriate locking style
|
** * sqlite3_file methods not associated with locking.
|
||||||
** * sqlite3_file methods not associated with locking
|
** * Definitions of sqlite3_io_methods objects for all locking
|
||||||
** * Implementations of sqlite3_os_init() and sqlite3_os_end()
|
** methods plus "finder" functions for each locking method.
|
||||||
|
** * VFS method implementations.
|
||||||
|
** * Definitions of sqlite3_vfs objects for all locking methods
|
||||||
|
** plus implementations of sqlite3_os_init() and sqlite3_os_end().
|
||||||
**
|
**
|
||||||
** $Id: os_unix.c,v 1.223 2008/11/29 00:56:53 drh Exp $
|
** $Id: os_unix.c,v 1.224 2008/11/29 02:20:27 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#if SQLITE_OS_UNIX /* This file is used on unix only */
|
#if SQLITE_OS_UNIX /* This file is used on unix only */
|
||||||
@@ -60,9 +63,6 @@
|
|||||||
** is defined to 1. The SQLITE_ENABLE_LOCKING_STYLE also enables automatic
|
** is defined to 1. The SQLITE_ENABLE_LOCKING_STYLE also enables automatic
|
||||||
** selection of the appropriate locking style based on the filesystem
|
** selection of the appropriate locking style based on the filesystem
|
||||||
** where the database is located.
|
** where the database is located.
|
||||||
**
|
|
||||||
** SQLITE_ENABLE_LOCKING_STYLE only works on a Mac. It is turned on by
|
|
||||||
** default on a Mac and disabled on all other posix platforms.
|
|
||||||
*/
|
*/
|
||||||
#if !defined(SQLITE_ENABLE_LOCKING_STYLE)
|
#if !defined(SQLITE_ENABLE_LOCKING_STYLE)
|
||||||
# if defined(__DARWIN__)
|
# if defined(__DARWIN__)
|
||||||
@@ -96,6 +96,11 @@
|
|||||||
** without this option, LFS is enable. But LFS does not exist in the kernel
|
** without this option, LFS is enable. But LFS does not exist in the kernel
|
||||||
** in RedHat 6.0, so the code won't work. Hence, for maximum binary
|
** in RedHat 6.0, so the code won't work. Hence, for maximum binary
|
||||||
** portability you should omit LFS.
|
** portability you should omit LFS.
|
||||||
|
**
|
||||||
|
** The previous paragraph was written in 2005. (This paragraph is written
|
||||||
|
** on 2008-11-28.) These days, all Linux kernels support large files, so
|
||||||
|
** you should probably leave LFS enabled. But some embedded platforms might
|
||||||
|
** lack LFS in which case the SQLITE_DISABLE_LFS macro might still be useful.
|
||||||
*/
|
*/
|
||||||
#ifndef SQLITE_DISABLE_LFS
|
#ifndef SQLITE_DISABLE_LFS
|
||||||
# define _LARGE_FILE 1
|
# define _LARGE_FILE 1
|
||||||
@@ -119,10 +124,10 @@
|
|||||||
#if SQLITE_ENABLE_LOCKING_STYLE
|
#if SQLITE_ENABLE_LOCKING_STYLE
|
||||||
# include <sys/ioctl.h>
|
# include <sys/ioctl.h>
|
||||||
# if OS_VXWORKS
|
# if OS_VXWORKS
|
||||||
# define lstat stat
|
|
||||||
# include <semaphore.h>
|
# include <semaphore.h>
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
# else
|
# else
|
||||||
|
# include <sys/file.h>
|
||||||
# include <sys/param.h>
|
# include <sys/param.h>
|
||||||
# include <sys/mount.h>
|
# include <sys/mount.h>
|
||||||
# endif
|
# endif
|
||||||
@@ -164,8 +169,8 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The unixFile structure is subclass of sqlite3_file specific for the unix
|
** The unixFile structure is subclass of sqlite3_file specific to the unix
|
||||||
** protability layer.
|
** VFS implementations.
|
||||||
*/
|
*/
|
||||||
typedef struct unixFile unixFile;
|
typedef struct unixFile unixFile;
|
||||||
struct unixFile {
|
struct unixFile {
|
||||||
@@ -419,7 +424,7 @@ struct vxworksFileId {
|
|||||||
|
|
||||||
#if OS_VXWORKS
|
#if OS_VXWORKS
|
||||||
/*
|
/*
|
||||||
** All unique filesname are held on a linked list headed by this
|
** All unique filenames are held on a linked list headed by this
|
||||||
** variable:
|
** variable:
|
||||||
*/
|
*/
|
||||||
static struct vxworksFileId *vxworksFileList = 0;
|
static struct vxworksFileId *vxworksFileList = 0;
|
||||||
@@ -429,8 +434,8 @@ static struct vxworksFileId *vxworksFileList = 0;
|
|||||||
** by making the following changes:
|
** by making the following changes:
|
||||||
**
|
**
|
||||||
** * removing any trailing and duplicate /
|
** * removing any trailing and duplicate /
|
||||||
** * removing /./
|
** * convert /./ into just /
|
||||||
** * removing /A/../
|
** * convert /A/../ where A is any simple name into just /
|
||||||
**
|
**
|
||||||
** Changes are made in-place. Return the new name length.
|
** Changes are made in-place. Return the new name length.
|
||||||
**
|
**
|
||||||
@@ -534,7 +539,7 @@ static void vxworksReleaseFileId(struct vxworksFileId *pId){
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*************************** Posix Advisory Locking ****************************
|
*************************** Posix Advisory Locking ****************************
|
||||||
**
|
**
|
||||||
** POSIX advisory locks broken by design. ANSI STD 1003.1 (1996)
|
** POSIX advisory locks are broken by design. ANSI STD 1003.1 (1996)
|
||||||
** section 6.5.2.2 lines 483 through 490 specify that when a process
|
** section 6.5.2.2 lines 483 through 490 specify that when a process
|
||||||
** sets or clears a lock, that operation overrides any prior locks set
|
** sets or clears a lock, that operation overrides any prior locks set
|
||||||
** by the same process. It does not explicitly say so, but this implies
|
** by the same process. It does not explicitly say so, but this implies
|
||||||
@@ -567,6 +572,10 @@ static void vxworksReleaseFileId(struct vxworksFileId *pId){
|
|||||||
** locks to see if another thread has previously set a lock on that same
|
** locks to see if another thread has previously set a lock on that same
|
||||||
** inode.
|
** inode.
|
||||||
**
|
**
|
||||||
|
** (Aside: The use of inode numbers as unique IDs does not work on VxWorks.
|
||||||
|
** For VxWorks, we have to use the alternative unique ID system based on
|
||||||
|
** canonical filename and implemented in the previous division.)
|
||||||
|
**
|
||||||
** The sqlite3_file structure for POSIX is no longer just an integer file
|
** The sqlite3_file structure for POSIX is no longer just an integer file
|
||||||
** descriptor. It is now a structure that holds the integer file
|
** descriptor. It is now a structure that holds the integer file
|
||||||
** descriptor and a pointer to a structure that describes the internal
|
** descriptor and a pointer to a structure that describes the internal
|
||||||
@@ -597,10 +606,10 @@ static void vxworksReleaseFileId(struct vxworksFileId *pId){
|
|||||||
** be closed and that list is walked (and cleared) when the last lock
|
** be closed and that list is walked (and cleared) when the last lock
|
||||||
** clears.
|
** clears.
|
||||||
**
|
**
|
||||||
** Yet another problem with posix locks and threads:
|
** Yet another problem: LinuxThreads do not play well with posix locks.
|
||||||
**
|
**
|
||||||
** Many older versions of linux us the LinuxThreads library which is
|
** Many older versions of linux use the LinuxThreads library which is
|
||||||
** not posix compliant. Under LinuxThreads, a lock created thread
|
** not posix compliant. Under LinuxThreads, a lock created by thread
|
||||||
** A cannot be modified or overridden by a different thread B.
|
** A cannot be modified or overridden by a different thread B.
|
||||||
** Only thread A can modify the lock. Locking behavior is correct
|
** Only thread A can modify the lock. Locking behavior is correct
|
||||||
** if the appliation uses the newer Native Posix Thread Library (NPTL)
|
** if the appliation uses the newer Native Posix Thread Library (NPTL)
|
||||||
@@ -613,7 +622,7 @@ static void vxworksReleaseFileId(struct vxworksFileId *pId){
|
|||||||
**
|
**
|
||||||
** On systems where thread A is unable to modify locks created by
|
** On systems where thread A is unable to modify locks created by
|
||||||
** thread B, we have to keep track of which thread created each
|
** thread B, we have to keep track of which thread created each
|
||||||
** lock. So there is an extra field in the key to the unixLockInfo
|
** lock. Hence there is an extra field in the key to the unixLockInfo
|
||||||
** structure to record this information. And on those systems it
|
** structure to record this information. And on those systems it
|
||||||
** is illegal to begin a transaction in one thread and finish it
|
** is illegal to begin a transaction in one thread and finish it
|
||||||
** in another. For this latter restriction, there is no work-around.
|
** in another. For this latter restriction, there is no work-around.
|
||||||
@@ -677,9 +686,8 @@ struct unixLockKey {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
** An instance of the following structure is allocated for each open
|
** An instance of the following structure is allocated for each open
|
||||||
** inode on each thread with a different process ID. (Threads have
|
** inode. Or, on LinuxThreads, there is one of these structures for
|
||||||
** different process IDs on some versions of linux, but not on most
|
** each inode opened by each thread.
|
||||||
** other unixes.)
|
|
||||||
**
|
**
|
||||||
** A single inode can have multiple file descriptors, so each unixFile
|
** A single inode can have multiple file descriptors, so each unixFile
|
||||||
** structure contains a pointer to an instance of this object and this
|
** structure contains a pointer to an instance of this object and this
|
||||||
@@ -700,6 +708,11 @@ struct unixLockInfo {
|
|||||||
** inode. If a close is attempted against an inode that is holding
|
** inode. If a close is attempted against an inode that is holding
|
||||||
** locks, the close is deferred until all locks clear by adding the
|
** locks, the close is deferred until all locks clear by adding the
|
||||||
** file descriptor to be closed to the pending list.
|
** file descriptor to be closed to the pending list.
|
||||||
|
**
|
||||||
|
** TODO: Consider changing this so that there is only a single file
|
||||||
|
** descriptor for each open file, even when it is opened multiple times.
|
||||||
|
** The close() system call would only occur when the last database
|
||||||
|
** using the file closes.
|
||||||
*/
|
*/
|
||||||
struct unixOpenCnt {
|
struct unixOpenCnt {
|
||||||
struct unixFileId fileId; /* The lookup key */
|
struct unixFileId fileId; /* The lookup key */
|
||||||
@@ -715,8 +728,8 @@ struct unixOpenCnt {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** List of all unixLockInfo and unixOpenCnt objects. This used to be a hash
|
** Lists of all unixLockInfo and unixOpenCnt objects. These used to be hash
|
||||||
** table. But the number of objects is rarely more than a dozen and
|
** tables. But the number of objects is rarely more than a dozen and
|
||||||
** never exceeds a few thousand. And lookup is not on a critical
|
** never exceeds a few thousand. And lookup is not on a critical
|
||||||
** path so a simple linked list will suffice.
|
** path so a simple linked list will suffice.
|
||||||
*/
|
*/
|
||||||
@@ -724,11 +737,11 @@ static struct unixLockInfo *lockList = 0;
|
|||||||
static struct unixOpenCnt *openList = 0;
|
static struct unixOpenCnt *openList = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** This variable records whether or not threads can override each others
|
** This variable remembers whether or not threads can override each others
|
||||||
** locks.
|
** locks.
|
||||||
**
|
**
|
||||||
** 0: No. Threads cannot override each others locks.
|
** 0: No. Threads cannot override each others locks. (LinuxThreads)
|
||||||
** 1: Yes. Threads can override each others locks.
|
** 1: Yes. Threads can override each others locks. (Posix & NLPT)
|
||||||
** -1: We don't know yet.
|
** -1: We don't know yet.
|
||||||
**
|
**
|
||||||
** On some systems, we know at compile-time if threads can override each
|
** On some systems, we know at compile-time if threads can override each
|
||||||
@@ -867,7 +880,6 @@ static void releaseOpenCnt(struct unixOpenCnt *pOpen){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Given a file descriptor, locate unixLockInfo and unixOpenCnt structures that
|
** Given a file descriptor, locate unixLockInfo and unixOpenCnt structures that
|
||||||
** describes that file descriptor. Create new ones if necessary. The
|
** describes that file descriptor. Create new ones if necessary. The
|
||||||
@@ -1459,6 +1471,10 @@ end_unlock:
|
|||||||
** common to all locking schemes. It closes the directory and file
|
** common to all locking schemes. It closes the directory and file
|
||||||
** handles, if they are valid, and sets all fields of the unixFile
|
** handles, if they are valid, and sets all fields of the unixFile
|
||||||
** structure to 0.
|
** structure to 0.
|
||||||
|
**
|
||||||
|
** It is *not* necessary to hold the mutex when this routine is called,
|
||||||
|
** even on VxWorks. A mutex will be acquired on VxWorks by the
|
||||||
|
** vxworksReleaseFileId() routine.
|
||||||
*/
|
*/
|
||||||
static int closeUnixFile(sqlite3_file *id){
|
static int closeUnixFile(sqlite3_file *id){
|
||||||
unixFile *pFile = (unixFile*)id;
|
unixFile *pFile = (unixFile*)id;
|
||||||
@@ -1550,36 +1566,25 @@ static int unixClose(sqlite3_file *id){
|
|||||||
** time and one or more of those connections are writing.
|
** time and one or more of those connections are writing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
** The nolockLockingContext is void
|
|
||||||
*/
|
|
||||||
typedef void nolockLockingContext;
|
|
||||||
|
|
||||||
static int nolockCheckReservedLock(sqlite3_file *NotUsed, int *pResOut){
|
static int nolockCheckReservedLock(sqlite3_file *NotUsed, int *pResOut){
|
||||||
UNUSED_PARAMETER(NotUsed);
|
UNUSED_PARAMETER(NotUsed);
|
||||||
*pResOut = 0;
|
*pResOut = 0;
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nolockLock(sqlite3_file *NotUsed, int NotUsed2){
|
static int nolockLock(sqlite3_file *NotUsed, int NotUsed2){
|
||||||
UNUSED_PARAMETER2(NotUsed, NotUsed2);
|
UNUSED_PARAMETER2(NotUsed, NotUsed2);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nolockUnlock(sqlite3_file *NotUsed, int NotUsed2){
|
static int nolockUnlock(sqlite3_file *NotUsed, int NotUsed2){
|
||||||
UNUSED_PARAMETER2(NotUsed, NotUsed2);
|
UNUSED_PARAMETER2(NotUsed, NotUsed2);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Close a file.
|
** Close the file.
|
||||||
*/
|
*/
|
||||||
static int nolockClose(sqlite3_file *id) {
|
static int nolockClose(sqlite3_file *id) {
|
||||||
int rc;
|
return closeUnixFile(id);
|
||||||
if( OS_VXWORKS ) unixEnterMutex();
|
|
||||||
rc = closeUnixFile(id);
|
|
||||||
if( OS_VXWORKS ) unixLeaveMutex();
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************* End of the no-op lock implementation *********************
|
/******************* End of the no-op lock implementation *********************
|
||||||
@@ -1766,7 +1771,7 @@ static int dotlockUnlock(sqlite3_file *id, int locktype) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Close a file.
|
** Close a file. Make sure the lock has been released before closing.
|
||||||
*/
|
*/
|
||||||
static int dotlockClose(sqlite3_file *id) {
|
static int dotlockClose(sqlite3_file *id) {
|
||||||
int rc;
|
int rc;
|
||||||
@@ -1775,9 +1780,7 @@ static int dotlockClose(sqlite3_file *id) {
|
|||||||
dotlockUnlock(id, NO_LOCK);
|
dotlockUnlock(id, NO_LOCK);
|
||||||
sqlite3_free(pFile->lockingContext);
|
sqlite3_free(pFile->lockingContext);
|
||||||
}
|
}
|
||||||
if( OS_VXWORKS ) unixEnterMutex();
|
|
||||||
rc = closeUnixFile(id);
|
rc = closeUnixFile(id);
|
||||||
if( OS_VXWORKS ) unixLeaveMutex();
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
/****************** End of the dot-file lock implementation *******************
|
/****************** End of the dot-file lock implementation *******************
|
||||||
@@ -1792,12 +1795,6 @@ static int dotlockClose(sqlite3_file *id) {
|
|||||||
** compiling for VXWORKS.
|
** compiling for VXWORKS.
|
||||||
*/
|
*/
|
||||||
#if SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS
|
#if SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS
|
||||||
#include <sys/file.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
** The flockLockingContext is not used
|
|
||||||
*/
|
|
||||||
typedef void flockLockingContext;
|
|
||||||
|
|
||||||
/* flock-style reserved lock checking following the behavior of
|
/* flock-style reserved lock checking following the behavior of
|
||||||
** unixCheckReservedLock, see the unixCheckReservedLock function comments */
|
** unixCheckReservedLock, see the unixCheckReservedLock function comments */
|
||||||
|
11
src/test1.c
11
src/test1.c
@@ -13,7 +13,7 @@
|
|||||||
** is not included in the SQLite library. It is used for automated
|
** is not included in the SQLite library. It is used for automated
|
||||||
** testing of the SQLite library.
|
** testing of the SQLite library.
|
||||||
**
|
**
|
||||||
** $Id: test1.c,v 1.333 2008/11/29 00:56:53 drh Exp $
|
** $Id: test1.c,v 1.334 2008/11/29 02:20:27 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "tcl.h"
|
#include "tcl.h"
|
||||||
@@ -4527,7 +4527,14 @@ static int file_control_lockproxy_test(
|
|||||||
}
|
}
|
||||||
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
|
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
|
||||||
|
|
||||||
#if defined(SQLITE_ENABLE_LOCKING_STYLE) && defined(__DARWIN__)
|
#if !defined(SQLITE_ENABLE_LOCKING_STYLE)
|
||||||
|
# if defined(__DARWIN__)
|
||||||
|
# define SQLITE_ENABLE_LOCKING_STYLE 1
|
||||||
|
# else
|
||||||
|
# define SQLITE_ENABLE_LOCKING_STYLE 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if SQLITE_ENABLE_LOCKING_STYLE && defined(__DARWIN__)
|
||||||
{
|
{
|
||||||
char *proxyPath = "test.proxy";
|
char *proxyPath = "test.proxy";
|
||||||
char *testPath;
|
char *testPath;
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
** The focus of this file is providing the TCL testing layer
|
** The focus of this file is providing the TCL testing layer
|
||||||
** access to compile-time constants.
|
** access to compile-time constants.
|
||||||
**
|
**
|
||||||
** $Id: test_config.c,v 1.44 2008/11/29 00:56:54 drh Exp $
|
** $Id: test_config.c,v 1.45 2008/11/29 02:20:27 drh Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sqliteLimit.h"
|
#include "sqliteLimit.h"
|
||||||
@@ -392,7 +392,14 @@ Tcl_SetVar2(interp, "sqlite_options", "long_double",
|
|||||||
Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY);
|
Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SQLITE_ENABLE_LOCKING_STYLE) && defined(__DARWIN__)
|
#if !defined(SQLITE_ENABLE_LOCKING_STYLE)
|
||||||
|
# if defined(__DARWIN__)
|
||||||
|
# define SQLITE_ENABLE_LOCKING_STYLE 1
|
||||||
|
# else
|
||||||
|
# define SQLITE_ENABLE_LOCKING_STYLE 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if SQLITE_ENABLE_LOCKING_STYLE && defined(__DARWIN__)
|
||||||
Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","1",TCL_GLOBAL_ONLY);
|
Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","1",TCL_GLOBAL_ONLY);
|
||||||
#else
|
#else
|
||||||
Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","0",TCL_GLOBAL_ONLY);
|
Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","0",TCL_GLOBAL_ONLY);
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
# This file implements regression tests for SQLite library. The
|
# This file implements regression tests for SQLite library. The
|
||||||
# focus of this script is database locks.
|
# focus of this script is database locks.
|
||||||
#
|
#
|
||||||
# $Id: lock5.test,v 1.4 2008/11/21 00:10:35 aswift Exp $
|
# $Id: lock5.test,v 1.5 2008/11/29 02:20:27 drh Exp $
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -24,6 +24,7 @@ if {[catch {sqlite3 db test.db -vfs unix-none} msg]} {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
db close
|
db close
|
||||||
|
file delete -force test.db.lock
|
||||||
|
|
||||||
ifcapable lock_proxy_pragmas {
|
ifcapable lock_proxy_pragmas {
|
||||||
set ::using_proxy 0
|
set ::using_proxy 0
|
||||||
|
Reference in New Issue
Block a user