-C Remove\san\sunused\stest\sfor\sEXPLAIN-mode\sin\sthe\sPRAGMA\sprocessing.\s(CVS\s6459)
-D 2009-04-07T00:49:16
+C Compile\sfixes\sand\simprovements\sfor\svxwork:\sfixed\sdeadlock\sin\ssemClose,\ndetect\sif\sfcntl\sis\susable,\sfall\sback\sto\snamed\ssemaphores\sif\snot.\s(CVS\s6460)
+D 2009-04-07T05:35:04
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/os.h fa3f4aa0119ff721a2da4b47ffd74406ac864c05
F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc
F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5
-F src/os_unix.c e5eef59cfb0f646b5010bc597b7c4a91534efc9b
+F src/os_unix.c 9ad9f45049a3c9eb0b0713b162ff0d7024ff7259
F src/os_win.c 524fe4c31c469531191857e8036ef59bfb52d684
F src/pager.c 1df277b7c78f780df119c9e2ddea6690979489c5
F src/pager.h 0c9f3520c00d8a3b8e792ca56c9a11b6b02b4b0f
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 567cf90b038a37da93d02954ef8f9f435dcc9a38
-R 9fccbb587b2c9a284607fd3746a1335c
-U drh
-Z aac902d0bf43c86a2936f0bc5216ba03
+P 909683b3428784ce91d222ccf887033d86250bd5
+R 1644d97c76c8c923de903afaae7ff2f3
+U chw
+Z 32650e63af9e81b186aac6c919550d61
** * 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.249 2009/04/07 00:35:20 drh Exp $
+** $Id: os_unix.c,v 1.250 2009/04/07 05:35:04 chw Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_UNIX /* This file is used on unix only */
unixEnterMutex();
releaseLockInfo(pFile->pLock);
releaseOpenCnt(pFile->pOpen);
- closeUnixFile(id);
unixLeaveMutex();
+ closeUnixFile(id);
}
return SQLITE_OK;
}
dotlockCheckReservedLock /* xCheckReservedLock method */
)
-#if SQLITE_ENABLE_LOCKING_STYLE
+#if SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS
IOMETHODS(
flockIoFinder, /* Finder function name */
flockIoMethods, /* sqlite3_io_methods object name */
#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */
+#if OS_VXWORKS && SQLITE_ENABLE_LOCKING_STYLE
+/*
+** This "finder" function attempts to determine the best locking strategy
+** for the database file "filePath". It then returns the sqlite3_io_methods
+** object that implements that strategy.
+**
+** This is for VXWorks only.
+*/
+static const sqlite3_io_methods *autolockIoFinderImpl(
+ const char *filePath, /* name of the database file */
+ int fd /* file descriptor open on the database file */
+){
+ struct flock lockInfo;
+
+ if( !filePath ){
+ /* If filePath==NULL that means we are dealing with a transient file
+ ** that does not need to be locked. */
+ return &nolockIoMethods;
+ }
+
+ /* Test if fcntl() is supported and use POSIX style locks.
+ ** Otherwise fall back to the named semaphore method.
+ */
+ lockInfo.l_len = 1;
+ lockInfo.l_start = 0;
+ lockInfo.l_whence = SEEK_SET;
+ lockInfo.l_type = F_RDLCK;
+ if( fcntl(fd, F_GETLK, &lockInfo)!=-1 ) {
+ return &posixIoMethods;
+ }else{
+ return &semIoMethods;
+ }
+}
+static const sqlite3_io_methods *(*const autolockIoFinder)(const char*,int)
+ = autolockIoFinderImpl;
+
+#endif /* OS_VXWORKS && SQLITE_ENABLE_LOCKING_STYLE */
+
/*
** An abstract type for a pointer to a IO method finder function:
*/
** array cannot be const.
*/
static sqlite3_vfs aVfs[] = {
-#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
+#if SQLITE_ENABLE_LOCKING_STYLE && (OS_VXWORKS || defined(__APPLE__))
UNIXVFS("unix", autolockIoFinder ),
#else
UNIXVFS("unix", posixIoFinder ),
#endif
#if SQLITE_ENABLE_LOCKING_STYLE
UNIXVFS("unix-posix", posixIoFinder ),
+#if !OS_VXWORKS
UNIXVFS("unix-flock", flockIoFinder ),
#endif
+#endif
#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
UNIXVFS("unix-afp", afpIoFinder ),
UNIXVFS("unix-proxy", proxyIoFinder ),