-C Enhancements\sto\sSQLITE_ENABLE_API_ARMOR\smerged\sfrom\strunk.
-D 2015-02-13T16:42:49.659
+C Move\sthe\sos_unix.c\sfile\scloser\sto\strunk.
+D 2015-02-19T02:43:19.628
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in e1f1fce0d47e29ffae67c92834d0e6e1c699743e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
-F src/os_unix.c 06e10d7aaf6b06947d9da35b38ff05000bf5058f
+F src/os_unix.c 56b0830336d47860be19610d057548c6303733c8
F src/os_win.c 1d1ef630b3e3859b7399952909e10d3a4d43fc77
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
F src/pager.c 694caffb16891a96608193968d7c9a8fa9a71240
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P b2449d67768f4d3d83877d9c45e5b4b17bb6a551 823ad40ccb5b51aaa0d5a48da63b465df9d0649a
-R 34fbf0e66795550d51489fb09903ffef
+P 5147b94ae6dc3e1bae5c506563347880c3a302b1
+R 6b3cfa6d91c403080a3780789432dd25
U drh
-Z ba17bdddc836de1631382089bbd63eae
+Z 90d307cc802c08c29ee77dea9a89c868
#include "sqliteInt.h"
#if SQLITE_OS_UNIX /* This file is used on unix only */
-#include "btreeInt.h" /* Use by Apple extensions only */
-
-
/*
** There are various methods for file locking used for concurrency
** control:
#if SQLITE_ENABLE_LOCKING_STYLE || OS_VXWORKS
# include <sys/ioctl.h>
# include <uuid/uuid.h>
-# if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \
- (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000))
-# define HAVE_GETHOSTUUID 1
-# endif
# if OS_VXWORKS
# include <semaphore.h>
# include <limits.h>
}
}
+/*
+** Set the pFile->lastErrno. Do this in a subroutine as that provides a convenient
+** place to set a breakpoint.
+*/
static void storeLastErrno(unixFile *pFile, int error){
pFile->lastErrno = error;
}
return;
}
if( fileHasMoved(pFile) ){
- sqlite3_log(SQLITE_WARNING, "file renamed while open: [%s]", pFile->zPath);
+ sqlite3_log(SQLITE_WARNING, "file renamed while open: %s", pFile->zPath);
pFile->ctrlFlags |= UNIXFILE_WARNED;
return;
}
unixEnterMutex();
/* unixFile.pInode is always valid here. Otherwise, a different close
- ** routine (e.g. nolockClose()) would be called instead.
- */
+ ** routine (e.g. nolockClose()) would be called instead.
+ */
assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 );
if( ALWAYS(pFile->pInode) && pFile->pInode->nLock ){
/* If there are outstanding locks, do not actually close the file just
- ** yet because that would clear those locks. Instead, add the file
- ** descriptor to pInode->pUnused list. It will be automatically closed
- ** when the last lock is cleared.
- */
+ ** yet because that would clear those locks. Instead, add the file
+ ** descriptor to pInode->pUnused list. It will be automatically closed
+ ** when the last lock is cleared.
+ */
setPendingFd(pFile);
}
releaseInodeInfo(pFile);
/* lastErrno set by seekAndRead */
return SQLITE_IOERR_READ;
}else{
+ storeLastErrno(pFile, 0); /* not a system error */
/* Unread parts of the buffer must be zero-filled */
memset(&((char*)pBuf)[got], 0, amt-got);
return SQLITE_IOERR_SHORT_READ;
/* lastErrno set by seekAndWrite */
return SQLITE_IOERR_WRITE;
}else{
+ storeLastErrno(pFile, 0); /* not a system error */
return SQLITE_FULL;
}
}
int rc;
if( pFile->szChunk<=0 ){
if( robust_ftruncate(pFile->h, nByte) ){
- pFile->lastErrno = errno;
+ storeLastErrno(pFile, errno);
return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
}
}
#if (SQLITE_ENABLE_APPLE_SPI>0) && defined(__APPLE__)
#include "sqlite3_private.h"
#include <copyfile.h>
-static int getDbPathForUnixFile(unixFile *pFile, char *dbPath);
+static int proxyGetDbPathForUnixFile(unixFile *pFile, char *dbPath);
#endif
#if SQLITE_ENABLE_LOCKING_STYLE
pShmNode = pInode->pShmNode;
if( pShmNode==0 ){
struct stat sStat; /* fstat() info for database file */
+#ifndef SQLITE_SHM_DIRECTORY
const char *zBasePath = pDbFd->zPath;
+#endif
/* Call fstat() to figure out the permissions on the database file. If
** a new *-shm file is created, an attempt will be made to create it
goto shm_open_err;
}
-#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
+#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE \
+ && !defined(SQLITE_SHM_DIRECTORY)
/* If pDbFd is configured with proxy locking mode, use the local
- ** lock file path to determine the -shm file path
- */
+ ** lock file path to determine the -shm file path
+ */
if( isProxyLockingMode(pDbFd) ){
zBasePath = proxySharedMemoryBasePath(pDbFd);
if( !zBasePath ){
if( pShmNode->nRef==0 ){
if( deleteFlag && pShmNode->h>=0 ) {
if (deleteFlag == 1) {
- unlink(pShmNode->zFilename);
+ osUnlink(pShmNode->zFilename);
} else if (deleteFlag == 2) {
/* ftruncate(pShmNode->h, 32 * 1024); */
}
}
#endif
- pNew->lastErrno = 0;
+ storeLastErrno(pNew, 0);
#if OS_VXWORKS
if( rc!=SQLITE_OK ){
if( h>=0 ) robust_close(pNew, h, __LINE__);
**
** C APIs
**
-** sqlite3_file_control(db, dbname, SQLITE_SET_LOCKPROXYFILE,
+** sqlite3_file_control(db, dbname, SQLITE_FCNTL_SET_LOCKPROXYFILE,
** <proxy_path> | ":auto:");
-** sqlite3_file_control(db, dbname, SQLITE_GET_LOCKPROXYFILE, &<proxy_path>);
+** sqlite3_file_control(db, dbname, SQLITE_FCNTL_GET_LOCKPROXYFILE,
+** &<proxy_path>);
**
**
** SQL pragmas
** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will
** force proxy locking to be used for every database file opened, and 0
** will force automatic proxy locking to be disabled for all database
-** files (explicitly calling the SQLITE_SET_LOCKPROXYFILE pragma or
+** files (explicitly calling the SQLITE_FCNTL_SET_LOCKPROXYFILE pragma or
** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING).
*/
static int proxyGetHostID(unsigned char *pHostID, int *pError){
assert(PROXY_HOSTIDLEN == sizeof(uuid_t));
memset(pHostID, 0, PROXY_HOSTIDLEN);
-#if HAVE_GETHOSTUUID
+# if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \
+ (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000))
{
struct timespec timeout = {1, 0}; /* 1 sec timeout */
-
if( gethostuuid(pHostID, &timeout) ){
int err = errno;
if( pError ){
** This routine find the filename associated with pFile and writes it
** int dbPath.
*/
-static int getDbPathForUnixFile(unixFile *pFile, char *dbPath){
+static int proxyGetDbPathForUnixFile(unixFile *pFile, char *dbPath){
#if defined(__APPLE__)
if( pFile->pMethod == &afpIoMethods ){
/* afp style keeps a reference to the db path in the filePath field
if( pFile->eFileLock!=NO_LOCK ){
return SQLITE_BUSY;
}
- getDbPathForUnixFile(pFile, dbPath);
+ proxyGetDbPathForUnixFile(pFile, dbPath);
if( !path || path[0]=='\0' || !strcmp(path, ":auto:") ){
lockPath=NULL;
}else{
*/
static int proxyFileControl(sqlite3_file *id, int op, void *pArg){
switch( op ){
- case SQLITE_GET_LOCKPROXYFILE: {
+ case SQLITE_FCNTL_GET_LOCKPROXYFILE: {
unixFile *pFile = (unixFile*)id;
if( isProxyLockingMode(pFile) ){
proxyLockingContext *pCtx = (proxyLockingContext*)pFile->lockingContext;
}
return SQLITE_OK;
}
- case SQLITE_SET_LOCKPROXYFILE: {
+ case SQLITE_FCNTL_SET_LOCKPROXYFILE: {
unixFile *pFile = (unixFile*)id;
int rc = SQLITE_OK;
int isProxyStyle = isProxyLockingMode(pFile);