-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-C Fix\san\sout-of-order\svariable\sdeclaration\sin\sshell.c.
-D 2011-03-15T18:35:44.256
+C Make\sthe\s"unix-excl"\sVFS\swork\sexactly\slike\s"unix"\sif\sthe\sdatabase\nfile\sis\sread-only.
+D 2011-03-15T19:08:48.027
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 27701a1653595a1f2187dc61c8117e00a6c1d50f
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 2596fd2d5d0976c6c0c628d0c3c7c4e7a724f4cf
-F src/os_unix.c 1debf5ea6efd0f35335a2a615198a7a1017ffd4b
+F src/os_unix.c 919972244dd7267815f9fc176b662390ff0b2348
F src/os_win.c 24d72407a90551969744cf9bcbb1b4c72c5fa845
F src/pager.c 6aa906b60a59664ba58d3f746164bb010d407ce1
F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P def98fd23e42bda13547e38ab13fed0e6554ce99
-R 2ceb7e2495de2e32fa2e2aca83b58f09
+P 725708465072fc63736e99610cc9cb0ac336145a
+R c6fd073182d6b083be2e4d503e5f99b8
U drh
-Z e7ee1c18a6d623c4d19a0ae664dea8d8
+Z 981ae6e8a2633665045ed876d4741a1e
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
-iD8DBQFNf7GDoxKgR168RlERAhc+AJ9qHfOaDlOtj2TqHpdpAXpIiMjRTwCeP6Tv
-esEJjmOwgIx+D+pi9BcOh8Y=
-=lte8
+iD8DBQFNf7lCoxKgR168RlERAhprAJkB1y4SWHLxKnmODUA6QMdw7pgj8wCgi+YB
+9Q1erlHqYv/DtUPtH7mUHBE=
+=2haN
-----END PGP SIGNATURE-----
** Allowed values for the unixFile.ctrlFlags bitmask:
*/
#define UNIXFILE_EXCL 0x01 /* Connections from one process only */
+#define UNIXFILE_RDONLY 0x02 /* Connection is read only */
/*
** Include code that is common to all os_*.c files
** Attempt to set a system-lock on the file pFile. The lock is
** described by pLock.
**
-** If the pFile was opened from unix-excl, then the only lock ever
-** obtained is an exclusive lock, and it is obtained exactly once
+** If the pFile was opened read/write from unix-excl, then the only lock
+** ever obtained is an exclusive lock, and it is obtained exactly once
** the first time any lock is attempted. All subsequent system locking
** operations become no-ops. Locking operations still happen internally,
** in order to coordinate access between separate database connections
** within this process, but all of that is handled in memory and the
** operating system does not participate.
+**
+** This function is a pass-through to fcntl(F_SETLK) if pFile is using
+** any VFS other than "unix-excl" or if pFile is opened on "unix-excl"
+** and is read-only.
*/
static int unixFileLock(unixFile *pFile, struct flock *pLock){
int rc;
unixInodeInfo *pInode = pFile->pInode;
assert( unixMutexHeld() );
assert( pInode!=0 );
- if( (pFile->ctrlFlags & UNIXFILE_EXCL)!=0 || pInode->bProcessLock ){
+ if( ((pFile->ctrlFlags & UNIXFILE_EXCL)!=0 || pInode->bProcessLock)
+ && ((pFile->ctrlFlags & UNIXFILE_RDONLY)==0)
+ ){
if( pInode->bProcessLock==0 ){
struct flock lock;
assert( pInode->nLock==0 );
sqlite3_file *pId, /* Write to the unixFile structure here */
const char *zFilename, /* Name of the file being opened */
int noLock, /* Omit locking if true */
- int isDelete /* Delete on close if true */
+ int isDelete, /* Delete on close if true */
+ int isReadOnly /* True if the file is opened read-only */
){
const sqlite3_io_methods *pLockingStyle;
unixFile *pNew = (unixFile *)pId;
}else{
pNew->ctrlFlags = 0;
}
+ if( isReadOnly ){
+ pNew->ctrlFlags |= UNIXFILE_RDONLY;
+ }
#if OS_VXWORKS
pNew->pId = vxworksFindFileId(zFilename);
openFlags &= ~(O_RDWR|O_CREAT);
flags |= SQLITE_OPEN_READONLY;
openFlags |= O_RDONLY;
+ isReadonly = 1;
fd = robust_open(zName, openFlags, openMode);
}
if( fd<0 ){
useProxy = !(fsInfo.f_flags&MNT_LOCAL);
}
if( useProxy ){
- rc = fillInUnixFile(pVfs, fd, dirfd, pFile, zPath, noLock, isDelete);
+ rc = fillInUnixFile(pVfs, fd, dirfd, pFile, zPath, noLock,
+ isDelete, isReadonly);
if( rc==SQLITE_OK ){
rc = proxyTransformUnixFile((unixFile*)pFile, ":auto:");
if( rc!=SQLITE_OK ){
}
#endif
- rc = fillInUnixFile(pVfs, fd, dirfd, pFile, zPath, noLock, isDelete);
+ rc = fillInUnixFile(pVfs, fd, dirfd, pFile, zPath, noLock,
+ isDelete, isReadonly);
open_finished:
if( rc!=SQLITE_OK ){
sqlite3_free(p->pUnused);
pUnused->flags = openFlags;
pNew->pUnused = pUnused;
- rc = fillInUnixFile(&dummyVfs, fd, dirfd, (sqlite3_file*)pNew, path, 0, 0);
+ rc = fillInUnixFile(&dummyVfs, fd, dirfd, (sqlite3_file*)pNew, path, 0, 0, 0);
if( rc==SQLITE_OK ){
*ppFile = pNew;
return SQLITE_OK;