mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
sync up our in tree sqlite with the 3.3.13 official release. Commit to follow to finish this process on the windows build.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4351 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -565,7 +565,7 @@ static sqlite3LockingStyle sqlite3TestLockingStyle(const char *filePath,
|
||||
lockInfo.l_whence = SEEK_SET;
|
||||
lockInfo.l_type = F_RDLCK;
|
||||
|
||||
if (fcntl(fd, F_GETLK, (int) &lockInfo) != -1) {
|
||||
if (fcntl(fd, F_GETLK, &lockInfo) != -1) {
|
||||
return posixLockingStyle;
|
||||
}
|
||||
|
||||
@@ -1000,10 +1000,14 @@ int sqlite3UnixIsDirWritable(char *zBuf){
|
||||
*/
|
||||
static int seekAndRead(unixFile *id, void *pBuf, int cnt){
|
||||
int got;
|
||||
i64 newOffset;
|
||||
#ifdef USE_PREAD
|
||||
got = pread(id->h, pBuf, cnt, id->offset);
|
||||
#else
|
||||
lseek(id->h, id->offset, SEEK_SET);
|
||||
newOffset = lseek(id->h, id->offset, SEEK_SET);
|
||||
if( newOffset!=id->offset ){
|
||||
return -1;
|
||||
}
|
||||
got = read(id->h, pBuf, cnt);
|
||||
#endif
|
||||
if( got>0 ){
|
||||
@@ -1026,12 +1030,13 @@ static int unixRead(OsFile *id, void *pBuf, int amt){
|
||||
TRACE5("READ %-3d %5d %7d %d\n", ((unixFile*)id)->h, got,
|
||||
last_page, TIMER_ELAPSED);
|
||||
SEEK(0);
|
||||
SimulateIOError( got=0 );
|
||||
SimulateIOError( got = -1 );
|
||||
if( got==amt ){
|
||||
return SQLITE_OK;
|
||||
}else if( got<0 ){
|
||||
return SQLITE_IOERR_READ;
|
||||
}else{
|
||||
memset(&((char*)pBuf)[got], 0, amt-got);
|
||||
return SQLITE_IOERR_SHORT_READ;
|
||||
}
|
||||
}
|
||||
@@ -1042,10 +1047,14 @@ static int unixRead(OsFile *id, void *pBuf, int amt){
|
||||
*/
|
||||
static int seekAndWrite(unixFile *id, const void *pBuf, int cnt){
|
||||
int got;
|
||||
i64 newOffset;
|
||||
#ifdef USE_PREAD
|
||||
got = pwrite(id->h, pBuf, cnt, id->offset);
|
||||
#else
|
||||
lseek(id->h, id->offset, SEEK_SET);
|
||||
newOffset = lseek(id->h, id->offset, SEEK_SET);
|
||||
if( newOffset!=id->offset ){
|
||||
return -1;
|
||||
}
|
||||
got = write(id->h, pBuf, cnt);
|
||||
#endif
|
||||
if( got>0 ){
|
||||
@@ -1159,13 +1168,26 @@ static int full_fsync(int fd, int fullSync, int dataOnly){
|
||||
#if HAVE_FULLFSYNC
|
||||
if( fullSync ){
|
||||
rc = fcntl(fd, F_FULLFSYNC, 0);
|
||||
}else
|
||||
#endif /* HAVE_FULLFSYNC */
|
||||
}else{
|
||||
rc = 1;
|
||||
}
|
||||
/* If the FULLFSYNC failed, fall back to attempting an fsync().
|
||||
* It shouldn't be possible for fullfsync to fail on the local
|
||||
* file system (on OSX), so failure indicates that FULLFSYNC
|
||||
* isn't supported for this file system. So, attempt an fsync
|
||||
* and (for now) ignore the overhead of a superfluous fcntl call.
|
||||
* It'd be better to detect fullfsync support once and avoid
|
||||
* the fcntl call every time sync is called.
|
||||
*/
|
||||
if( rc ) rc = fsync(fd);
|
||||
|
||||
#else
|
||||
if( dataOnly ){
|
||||
rc = fdatasync(fd);
|
||||
}else{
|
||||
rc = fsync(fd);
|
||||
}
|
||||
#endif /* HAVE_FULLFSYNC */
|
||||
#endif /* defined(SQLITE_NO_SYNC) */
|
||||
|
||||
return rc;
|
||||
@@ -2445,12 +2467,12 @@ static int allocateUnixFile(
|
||||
const char *zFilename, /* Name of the file being opened */
|
||||
int delFlag /* Delete-on-or-before-close flag */
|
||||
){
|
||||
sqlite3LockingStyle lockStyle;
|
||||
sqlite3LockingStyle lockingStyle;
|
||||
unixFile *pNew;
|
||||
unixFile f;
|
||||
int rc;
|
||||
|
||||
lockingStyle = sqlite3DetectLockingStyle(zFilename, f.h);
|
||||
lockingStyle = sqlite3DetectLockingStyle(zFilename, h);
|
||||
if ( lockingStyle == posixLockingStyle ) {
|
||||
sqlite3OsEnterMutex();
|
||||
rc = findLockInfo(h, &f.pLock, &f.pOpen);
|
||||
@@ -2485,7 +2507,7 @@ static int allocateUnixFile(
|
||||
return SQLITE_NOMEM;
|
||||
}else{
|
||||
*pNew = f;
|
||||
switch(lockStyle) {
|
||||
switch(lockingStyle) {
|
||||
case afpLockingStyle:
|
||||
/* afp locking uses the file path so it needs to be included in
|
||||
** the afpLockingContext */
|
||||
@@ -2581,6 +2603,23 @@ static int allocateUnixFile(
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef SQLITE_OMIT_LOAD_EXTENSION
|
||||
/*
|
||||
** Interfaces for opening a shared library, finding entry points
|
||||
** within the shared library, and closing the shared library.
|
||||
*/
|
||||
#include <dlfcn.h>
|
||||
void *sqlite3UnixDlopen(const char *zFilename){
|
||||
return dlopen(zFilename, RTLD_NOW | RTLD_GLOBAL);
|
||||
}
|
||||
void *sqlite3UnixDlsym(void *pHandle, const char *zSymbol){
|
||||
return dlsym(pHandle, zSymbol);
|
||||
}
|
||||
int sqlite3UnixDlclose(void *pHandle){
|
||||
return dlclose(pHandle);
|
||||
}
|
||||
#endif /* SQLITE_OMIT_LOAD_EXTENSION */
|
||||
|
||||
/*
|
||||
** Get information to seed the random number generator. The seed
|
||||
** is written into the buffer zBuf[256]. The calling function must
|
||||
|
Reference in New Issue
Block a user