From 40bbb0a3e8b1ef8392c19ee1f6e213474fcdf3e1 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 23 Sep 2008 10:23:26 +0000 Subject: [PATCH] Enable the LOCKING_STYLE extensions by default on a Mac. Leave them disabled on all other posix platforms. (CVS 5737) FossilOrigin-Name: bae1d5b16948705b7dec7b139e3586b4b510cbfa --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_unix.c | 35 ++++++++++++++++++++++------------- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/manifest b/manifest index 0368390614..c1d09bf535 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\san\sunused\svariable\sfrom\sthe\stest\slogic.\s(CVS\s5736) -D 2008-09-23T10:16:05 +C Enable\sthe\sLOCKING_STYLE\sextensions\sby\sdefault\son\sa\sMac.\s\sLeave\sthem\ndisabled\son\sall\sother\sposix\splatforms.\s(CVS\s5737) +D 2008-09-23T10:23:26 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in e4ab842f9a64ef61d57093539a8aab76b12810db F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -135,7 +135,7 @@ F src/os.c 543976efc0b177b40779d5fc00f709d6888d6903 F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892 F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60 F src/os_os2.c e391fc95adc744bbdcefd4d11e3066998185a0a0 -F src/os_unix.c badd226d71460f0be57f68843ef66a258b0a376c +F src/os_unix.c ee778087d7b73746598947a93d2e1de3f909c9c2 F src/os_win.c 3209dc0ed734291764393ea8d534ba0d8696a540 F src/pager.c 131746ea47383daf89fce08e0cb09b84cffa39eb F src/pager.h 1ef5a3f8e0b4c8b30f19c8e01d4fca2db9bb5797 @@ -637,7 +637,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P a88606245760eaf8054d67773db7d8b795e8ca25 -R 5f4ced03c359d22319ca21d407dd7159 +P 309ba380d985d77419a6e185373493e043823258 +R 2c9572d754434b5bfdf3e25c7b3dbb14 U drh -Z a47e0f847ded8ccc3b472866b58d53b2 +Z 1990ad5dc1d65a186d212ae883760b71 diff --git a/manifest.uuid b/manifest.uuid index dd52f5cd3c..3fc56fe4c6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -309ba380d985d77419a6e185373493e043823258 \ No newline at end of file +bae1d5b16948705b7dec7b139e3586b4b510cbfa \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index ea38ec5cf9..d9272eef97 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 #include -#ifdef SQLITE_ENABLE_LOCKING_STYLE +#if SQLITE_ENABLE_LOCKING_STYLE #include #include #include @@ -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), -- 2.47.2