diff options
author | drh <drh@noemail.net> | 2008-09-23 10:23:26 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2008-09-23 10:23:26 +0000 |
commit | 40bbb0a3e8b1ef8392c19ee1f6e213474fcdf3e1 (patch) | |
tree | b3db7469b718fb057ced9767c38f0d1b9a23197f /src/os_unix.c | |
parent | c21658beaadb3ee1a9f6c0c81b71a72b3e026515 (diff) | |
download | sqlite-40bbb0a3e8b1ef8392c19ee1f6e213474fcdf3e1.tar.gz sqlite-40bbb0a3e8b1ef8392c19ee1f6e213474fcdf3e1.zip |
Enable the LOCKING_STYLE extensions by default on a Mac. Leave them
disabled on all other posix platforms. (CVS 5737)
FossilOrigin-Name: bae1d5b16948705b7dec7b139e3586b4b510cbfa
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index ea38ec5cf..d9272eef9 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -12,22 +12,31 @@ ** ** This file contains code that is specific to Unix systems. ** -** $Id: os_unix.c,v 1.202 2008/09/22 11:46:33 danielk1977 Exp $ +** $Id: os_unix.c,v 1.203 2008/09/23 10:23:26 drh Exp $ */ #include "sqliteInt.h" #if SQLITE_OS_UNIX /* This file is used on unix only */ /* -** If SQLITE_ENABLE_LOCKING_STYLE is defined, then several different -** locking implementations are provided: +** If SQLITE_ENABLE_LOCKING_STYLE is defined and is non-zero, then several +** alternative locking implementations are provided: ** ** * POSIX locking (the default), ** * No locking, ** * Dot-file locking, ** * flock() locking, ** * AFP locking (OSX only). -*/ -/* #define SQLITE_ENABLE_LOCKING_STYLE 0 */ +** +** 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(__DARWIN__) +# define SQLITE_ENABLE_LOCKING_STYLE 1 +# else +# define SQLITE_ENABLE_LOCKING_STYLE 0 +# endif +#endif /* ** These #defines should enable >2GB file support on Posix if the @@ -61,7 +70,7 @@ #include <sys/time.h> #include <errno.h> -#ifdef SQLITE_ENABLE_LOCKING_STYLE +#if SQLITE_ENABLE_LOCKING_STYLE #include <sys/ioctl.h> #include <sys/param.h> #include <sys/mount.h> @@ -104,7 +113,7 @@ struct unixFile { #endif struct openCnt *pOpen; /* Info about all open fd's on this inode */ struct lockInfo *pLock; /* Info about locks on this inode */ -#ifdef SQLITE_ENABLE_LOCKING_STYLE +#if SQLITE_ENABLE_LOCKING_STYLE void *lockingContext; /* Locking style specific state */ #endif int h; /* The file descriptor */ @@ -573,7 +582,7 @@ static void releaseOpenCnt(struct openCnt *pOpen){ } } -#ifdef SQLITE_ENABLE_LOCKING_STYLE +#if SQLITE_ENABLE_LOCKING_STYLE /* ** Tests a byte-range locking query to see if byte range locks are ** supported, if not we fall back to dotlockLockingStyle. @@ -615,7 +624,7 @@ static int detectLockingStyle( const char *filePath, int fd ){ -#ifdef SQLITE_ENABLE_LOCKING_STYLE +#if SQLITE_ENABLE_LOCKING_STYLE struct Mapping { const char *zFilesystem; int eLockingStyle; @@ -1662,7 +1671,7 @@ static int unixClose(sqlite3_file *id){ } -#ifdef SQLITE_ENABLE_LOCKING_STYLE +#if SQLITE_ENABLE_LOCKING_STYLE #pragma mark AFP Support /* @@ -2352,7 +2361,7 @@ static int fillInUnixFile( static sqlite3_io_methods aIoMethod[] = { IOMETHODS(unixClose, unixLock, unixUnlock, unixCheckReservedLock) ,IOMETHODS(nolockClose, nolockLock, nolockUnlock, nolockCheckReservedLock) -#ifdef SQLITE_ENABLE_LOCKING_STYLE +#if SQLITE_ENABLE_LOCKING_STYLE ,IOMETHODS(dotlockClose, dotlockLock, dotlockUnlock,dotlockCheckReservedLock) ,IOMETHODS(flockClose, flockLock, flockUnlock, flockCheckReservedLock) ,IOMETHODS(afpClose, afpLock, afpUnlock, afpCheckReservedLock) @@ -2390,7 +2399,7 @@ static int fillInUnixFile( break; } -#ifdef SQLITE_ENABLE_LOCKING_STYLE +#if SQLITE_ENABLE_LOCKING_STYLE case LOCKING_STYLE_AFP: { /* AFP locking uses the file path so it needs to be included in ** the afpLockingContext. @@ -2951,7 +2960,7 @@ int sqlite3_os_init(void){ } static sqlite3_vfs unixVfs = UNIXVFS("unix", 0); -#ifdef SQLITE_ENABLE_LOCKING_STYLE +#if SQLITE_ENABLE_LOCKING_STYLE int i; static sqlite3_vfs aVfs[] = { UNIXVFS("unix-posix", LOCKING_STYLE_POSIX), |