mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Modify sources to that they can be combined into a single sqlite3.c source
file. Eliminate all type-pruned pointer warnings. (CVS 3722) FossilOrigin-Name: 0b832e218ec12b0eb559e407d80aba6709e2ea85
This commit is contained in:
@@ -753,19 +753,20 @@ static int transferOwnership(unixFile *pFile){
|
||||
hSelf = pthread_self();
|
||||
if( pthread_equal(pFile->tid, hSelf) ){
|
||||
/* We are still in the same thread */
|
||||
TRACE1("No-transfer, same thread\n");
|
||||
OSTRACE1("No-transfer, same thread\n");
|
||||
return SQLITE_OK;
|
||||
}
|
||||
if( pFile->locktype!=NO_LOCK ){
|
||||
/* We cannot change ownership while we are holding a lock! */
|
||||
return SQLITE_MISUSE;
|
||||
}
|
||||
TRACE4("Transfer ownership of %d from %d to %d\n", pFile->h,pFile->tid,hSelf);
|
||||
OSTRACE4("Transfer ownership of %d from %d to %d\n",
|
||||
pFile->h, pFile->tid, hSelf);
|
||||
pFile->tid = hSelf;
|
||||
if (pFile->pLock != NULL) {
|
||||
releaseLockInfo(pFile->pLock);
|
||||
rc = findLockInfo(pFile->h, &pFile->pLock, 0);
|
||||
TRACE5("LOCK %d is now %s(%s,%d)\n", pFile->h,
|
||||
OSTRACE5("LOCK %d is now %s(%s,%d)\n", pFile->h,
|
||||
locktypeName(pFile->locktype),
|
||||
locktypeName(pFile->pLock->locktype), pFile->pLock->cnt);
|
||||
return rc;
|
||||
@@ -925,7 +926,7 @@ static int unixOpenDirectory(
|
||||
if( pFile->dirfd<0 ){
|
||||
return SQLITE_CANTOPEN;
|
||||
}
|
||||
TRACE3("OPENDIR %-3d %s\n", pFile->dirfd, zDirname);
|
||||
OSTRACE3("OPENDIR %-3d %s\n", pFile->dirfd, zDirname);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
@@ -1014,7 +1015,7 @@ static int seekAndRead(unixFile *id, void *pBuf, int cnt){
|
||||
got = read(id->h, pBuf, cnt);
|
||||
#endif
|
||||
TIMER_END;
|
||||
TRACE5("READ %-3d %5d %7lld %d\n", id->h, got, id->offset, TIMER_ELAPSED);
|
||||
OSTRACE5("READ %-3d %5d %7lld %d\n", id->h, got, id->offset, TIMER_ELAPSED);
|
||||
if( got>0 ){
|
||||
id->offset += got;
|
||||
}
|
||||
@@ -1061,7 +1062,7 @@ static int seekAndWrite(unixFile *id, const void *pBuf, int cnt){
|
||||
got = write(id->h, pBuf, cnt);
|
||||
#endif
|
||||
TIMER_END;
|
||||
TRACE5("WRITE %-3d %5d %7lld %d\n", id->h, got, id->offset, TIMER_ELAPSED);
|
||||
OSTRACE5("WRITE %-3d %5d %7lld %d\n", id->h, got, id->offset, TIMER_ELAPSED);
|
||||
if( got>0 ){
|
||||
id->offset += got;
|
||||
}
|
||||
@@ -1211,14 +1212,14 @@ static int unixSync(OsFile *id, int dataOnly){
|
||||
int rc;
|
||||
unixFile *pFile = (unixFile*)id;
|
||||
assert( pFile );
|
||||
TRACE2("SYNC %-3d\n", pFile->h);
|
||||
OSTRACE2("SYNC %-3d\n", pFile->h);
|
||||
rc = full_fsync(pFile->h, pFile->fullSync, dataOnly);
|
||||
SimulateIOError( rc=1 );
|
||||
if( rc ){
|
||||
return SQLITE_IOERR_FSYNC;
|
||||
}
|
||||
if( pFile->dirfd>=0 ){
|
||||
TRACE4("DIRSYNC %-3d (have_fullfsync=%d fullsync=%d)\n", pFile->dirfd,
|
||||
OSTRACE4("DIRSYNC %-3d (have_fullfsync=%d fullsync=%d)\n", pFile->dirfd,
|
||||
HAVE_FULLFSYNC, pFile->fullSync);
|
||||
#ifndef SQLITE_DISABLE_DIRSYNC
|
||||
/* The directory sync is only attempted if full_fsync is
|
||||
@@ -1256,7 +1257,7 @@ int sqlite3UnixSyncDirectory(const char *zDirname){
|
||||
int fd;
|
||||
int r;
|
||||
fd = open(zDirname, O_RDONLY|O_BINARY, 0);
|
||||
TRACE3("DIRSYNC %-3d (%s)\n", fd, zDirname);
|
||||
OSTRACE3("DIRSYNC %-3d (%s)\n", fd, zDirname);
|
||||
if( fd<0 ){
|
||||
return SQLITE_CANTOPEN;
|
||||
}
|
||||
@@ -1335,7 +1336,7 @@ static int unixCheckReservedLock(OsFile *id){
|
||||
}
|
||||
|
||||
sqlite3OsLeaveMutex();
|
||||
TRACE3("TEST WR-LOCK %d %d\n", pFile->h, r);
|
||||
OSTRACE3("TEST WR-LOCK %d %d\n", pFile->h, r);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -1410,7 +1411,7 @@ static int unixLock(OsFile *id, int locktype){
|
||||
int s;
|
||||
|
||||
assert( pFile );
|
||||
TRACE7("LOCK %d %s was %s(%s,%d) pid=%d\n", pFile->h,
|
||||
OSTRACE7("LOCK %d %s was %s(%s,%d) pid=%d\n", pFile->h,
|
||||
locktypeName(locktype), locktypeName(pFile->locktype),
|
||||
locktypeName(pLock->locktype), pLock->cnt , getpid());
|
||||
|
||||
@@ -1419,7 +1420,7 @@ static int unixLock(OsFile *id, int locktype){
|
||||
** sqlite3OsEnterMutex() hasn't been called yet.
|
||||
*/
|
||||
if( pFile->locktype>=locktype ){
|
||||
TRACE3("LOCK %d %s ok (already held)\n", pFile->h,
|
||||
OSTRACE3("LOCK %d %s ok (already held)\n", pFile->h,
|
||||
locktypeName(locktype));
|
||||
return SQLITE_OK;
|
||||
}
|
||||
@@ -1554,7 +1555,7 @@ static int unixLock(OsFile *id, int locktype){
|
||||
|
||||
end_lock:
|
||||
sqlite3OsLeaveMutex();
|
||||
TRACE4("LOCK %d %s %s\n", pFile->h, locktypeName(locktype),
|
||||
OSTRACE4("LOCK %d %s %s\n", pFile->h, locktypeName(locktype),
|
||||
rc==SQLITE_OK ? "ok" : "failed");
|
||||
return rc;
|
||||
}
|
||||
@@ -1573,7 +1574,7 @@ static int unixUnlock(OsFile *id, int locktype){
|
||||
unixFile *pFile = (unixFile*)id;
|
||||
|
||||
assert( pFile );
|
||||
TRACE7("UNLOCK %d %d was %d(%d,%d) pid=%d\n", pFile->h, locktype,
|
||||
OSTRACE7("UNLOCK %d %d was %d(%d,%d) pid=%d\n", pFile->h, locktype,
|
||||
pFile->locktype, pFile->pLock->locktype, pFile->pLock->cnt, getpid());
|
||||
|
||||
assert( locktype<=SHARED_LOCK );
|
||||
@@ -1686,7 +1687,7 @@ static int unixClose(OsFile **pId){
|
||||
|
||||
sqlite3OsLeaveMutex();
|
||||
id->isOpen = 0;
|
||||
TRACE2("CLOSE %-3d\n", id->h);
|
||||
OSTRACE2("CLOSE %-3d\n", id->h);
|
||||
OpenCounter(-1);
|
||||
sqlite3ThreadSafeFree(id);
|
||||
*pId = 0;
|
||||
@@ -1733,11 +1734,11 @@ static int _AFPFSSetLock(const char *path, int fd, unsigned long long offset,
|
||||
pb.offset = offset;
|
||||
pb.length = length;
|
||||
pb.fd = fd;
|
||||
TRACE5("AFPLOCK setting lock %s for %d in range %llx:%llx\n",
|
||||
OSTRACE5("AFPLOCK setting lock %s for %d in range %llx:%llx\n",
|
||||
(setLockFlag?"ON":"OFF"), fd, offset, length);
|
||||
err = fsctl(path, afpfsByteRangeLock2FSCTL, &pb, 0);
|
||||
if ( err==-1 ) {
|
||||
TRACE4("AFPLOCK failed to fsctl() '%s' %d %s\n", path, errno,
|
||||
OSTRACE4("AFPLOCK failed to fsctl() '%s' %d %s\n", path, errno,
|
||||
strerror(errno));
|
||||
return 1; // error
|
||||
} else {
|
||||
@@ -1777,7 +1778,7 @@ static int afpUnixCheckReservedLock(OsFile *id){
|
||||
_AFPFSSetLock(context->filePath, pFile->h, RESERVED_BYTE, 1, 0);
|
||||
}
|
||||
}
|
||||
TRACE3("TEST WR-LOCK %d %d\n", pFile->h, r);
|
||||
OSTRACE3("TEST WR-LOCK %d %d\n", pFile->h, r);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -1792,14 +1793,14 @@ static int afpUnixLock(OsFile *id, int locktype)
|
||||
int gotPendingLock = 0;
|
||||
|
||||
assert( pFile );
|
||||
TRACE5("LOCK %d %s was %s pid=%d\n", pFile->h,
|
||||
OSTRACE5("LOCK %d %s was %s pid=%d\n", pFile->h,
|
||||
locktypeName(locktype), locktypeName(pFile->locktype), getpid());
|
||||
/* If there is already a lock of this type or more restrictive on the
|
||||
** OsFile, do nothing. Don't use the afp_end_lock: exit path, as
|
||||
** sqlite3OsEnterMutex() hasn't been called yet.
|
||||
*/
|
||||
if( pFile->locktype>=locktype ){
|
||||
TRACE3("LOCK %d %s ok (already held)\n", pFile->h,
|
||||
OSTRACE3("LOCK %d %s ok (already held)\n", pFile->h,
|
||||
locktypeName(locktype));
|
||||
return SQLITE_OK;
|
||||
}
|
||||
@@ -1906,7 +1907,7 @@ static int afpUnixLock(OsFile *id, int locktype)
|
||||
|
||||
afp_end_lock:
|
||||
sqlite3OsLeaveMutex();
|
||||
TRACE4("LOCK %d %s %s\n", pFile->h, locktypeName(locktype),
|
||||
OSTRACE4("LOCK %d %s %s\n", pFile->h, locktypeName(locktype),
|
||||
rc==SQLITE_OK ? "ok" : "failed");
|
||||
return rc;
|
||||
}
|
||||
@@ -1925,7 +1926,7 @@ static int afpUnixUnlock(OsFile *id, int locktype) {
|
||||
afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;
|
||||
|
||||
assert( pFile );
|
||||
TRACE5("UNLOCK %d %d was %d pid=%d\n", pFile->h, locktype,
|
||||
OSTRACE5("UNLOCK %d %d was %d pid=%d\n", pFile->h, locktype,
|
||||
pFile->locktype, getpid());
|
||||
|
||||
assert( locktype<=SHARED_LOCK );
|
||||
@@ -2002,7 +2003,7 @@ static int afpUnixClose(OsFile **pId) {
|
||||
id->dirfd = -1;
|
||||
close(id->h);
|
||||
id->isOpen = 0;
|
||||
TRACE2("CLOSE %-3d\n", id->h);
|
||||
OSTRACE2("CLOSE %-3d\n", id->h);
|
||||
OpenCounter(-1);
|
||||
sqlite3ThreadSafeFree(id);
|
||||
*pId = 0;
|
||||
@@ -2098,7 +2099,7 @@ static int flockUnixClose(OsFile **pId) {
|
||||
close(id->h);
|
||||
sqlite3OsLeaveMutex();
|
||||
id->isOpen = 0;
|
||||
TRACE2("CLOSE %-3d\n", id->h);
|
||||
OSTRACE2("CLOSE %-3d\n", id->h);
|
||||
OpenCounter(-1);
|
||||
sqlite3ThreadSafeFree(id);
|
||||
*pId = 0;
|
||||
@@ -2217,7 +2218,7 @@ static int dotlockUnixClose(OsFile **pId) {
|
||||
|
||||
sqlite3OsLeaveMutex();
|
||||
id->isOpen = 0;
|
||||
TRACE2("CLOSE %-3d\n", id->h);
|
||||
OSTRACE2("CLOSE %-3d\n", id->h);
|
||||
OpenCounter(-1);
|
||||
sqlite3ThreadSafeFree(id);
|
||||
*pId = 0;
|
||||
@@ -2259,7 +2260,7 @@ static int nolockUnixClose(OsFile **pId) {
|
||||
|
||||
sqlite3OsLeaveMutex();
|
||||
id->isOpen = 0;
|
||||
TRACE2("CLOSE %-3d\n", id->h);
|
||||
OSTRACE2("CLOSE %-3d\n", id->h);
|
||||
OpenCounter(-1);
|
||||
sqlite3ThreadSafeFree(id);
|
||||
*pId = 0;
|
||||
@@ -2588,7 +2589,7 @@ static int allocateUnixFile(
|
||||
close(h);
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
TRACE3("OPEN %-3d %s\n", h, zFilename);
|
||||
OSTRACE3("OPEN %-3d %s\n", h, zFilename);
|
||||
f.dirfd = -1;
|
||||
f.fullSync = 0;
|
||||
f.locktype = 0;
|
||||
|
||||
Reference in New Issue
Block a user