Home | History | Annotate | Download | only in dist

Lines Matching defs:pFile

14819   sqlite3_file *pFile, 
14829 rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x87f7f, pFlagsOut);
14830 assert( rc==SQLITE_OK || pFile->pMethods==0 );
14903 sqlite3_file *pFile;
14904 pFile = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile);
14905 if( pFile ){
14906 rc = sqlite3OsOpen(pVfs, zFile, pFile, flags, pOutFlags);
14908 sqlite3_free(pFile);
14910 *ppFile = pFile;
14915 SQLITE_PRIVATE int sqlite3OsCloseFree(sqlite3_file *pFile){
14917 assert( pFile );
14918 rc = sqlite3OsClose(pFile);
14919 sqlite3_free(pFile);
22978 os2File *pFile = (os2File*)id;
22981 OSTRACE(( "CLOSE %d (%s)\n", pFile->h, pFile->zFullPathCp ));
22983 rc = DosClose( pFile->h );
22985 if( pFile->flags & SQLITE_OPEN_DELETEONCLOSE )
22986 DosForceDelete( (PSZ)pFile->zFullPathCp );
22988 free( pFile->zFullPathCp );
22989 pFile->zFullPathCp = NULL;
22990 pFile->locktype = NO_LOCK;
22991 pFile->h = (HFILE)-1;
22992 pFile->flags = 0;
23011 os2File *pFile = (os2File*)id;
23014 OSTRACE(( "READ %d lock=%d\n", pFile->h, pFile->locktype ));
23015 if( DosSetFilePtr(pFile->h, offset, FILE_BEGIN, &fileLocation) != NO_ERROR ){
23018 if( DosRead( pFile->h, pBuf, amt, &got ) != NO_ERROR ){
23043 os2File *pFile = (os2File*)id;
23047 OSTRACE(( "WRITE %d lock=%d\n", pFile->h, pFile->locktype ));
23048 if( DosSetFilePtr(pFile->h, offset, FILE_BEGIN, &fileLocation) != NO_ERROR ){
23053 ( rc = DosWrite( pFile->h, (PVOID)pBuf, amt, &wrote ) ) == NO_ERROR &&
23068 os2File *pFile = (os2File*)id;
23070 OSTRACE(( "TRUNCATE %d %lld\n", pFile->h, nByte ));
23078 if( pFile->szChunk ){
23079 nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk;
23082 rc = DosSetFileSize( pFile->h, nByte );
23099 os2File *pFile = (os2File*)id;
23100 OSTRACE(( "SYNC %d lock=%d\n", pFile->h, pFile->locktype ));
23111 UNUSED_PARAMETER(pFile);
23114 return DosResetBuffer( pFile->h ) == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
23139 static int getReadLock( os2File *pFile ){
23149 res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 1L );
23150 OSTRACE(( "GETREADLOCK %d res=%d\n", pFile->h, res ));
23201 int newLocktype; /* Set pFile->locktype to this value before exiting */
23205 os2File *pFile = (os2File*)id;
23208 assert( pFile!=0 );
23209 OSTRACE(( "LOCK %d %d was %d\n", pFile->h, locktype, pFile->locktype ));
23215 if( pFile->locktype>=locktype ){
23216 OSTRACE(( "LOCK %d %d ok (already held)\n", pFile->h, locktype ));
23222 assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );
23224 assert( locktype!=RESERVED_LOCK || pFile->locktype==SHARED_LOCK );
23230 newLocktype = pFile->locktype;
23231 if( pFile->locktype==NO_LOCK
23232 || (locktype==EXCLUSIVE_LOCK && pFile->locktype==RESERVED_LOCK)
23240 res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 100L, 0L );
23243 OSTRACE(( "LOCK %d pending lock boolean set. res=%d\n", pFile->h, res ));
23250 assert( pFile->locktype==NO_LOCK );
23251 res = getReadLock(pFile);
23255 OSTRACE(( "LOCK %d acquire shared lock. res=%d\n", pFile->h, res ));
23261 assert( pFile->locktype==SHARED_LOCK );
23266 res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
23270 OSTRACE(( "LOCK %d acquire reserved lock. res=%d\n", pFile->h, res ));
23279 pFile->h ));
23285 assert( pFile->locktype>=SHARED_LOCK );
23286 res = unlockReadLock(pFile);
23292 res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
23297 getReadLock(pFile);
23299 OSTRACE(( "LOCK %d acquire exclusive lock. res=%d\n", pFile->h, res ));
23311 r = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
23312 OSTRACE(( "LOCK %d unlocking pending/is shared. r=%d\n", pFile->h, r ));
23321 OSTRACE(( "LOCK FAILED %d trying for %d but got %d\n", pFile->h,
23325 pFile->locktype = newLocktype;
23326 OSTRACE(( "LOCK %d now %d\n", pFile->h, pFile->locktype ));
23337 os2File *pFile = (os2File*)id;
23338 assert( pFile!=0 );
23339 if( pFile->locktype>=RESERVED_LOCK ){
23341 OSTRACE(( "TEST WR-LOCK %d %d (local)\n", pFile->h, r ));
23352 rc = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
23353 OSTRACE(( "TEST WR-LOCK %d lock reserved byte rc=%d\n", pFile->h, rc ));
23360 rcu = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
23361 OSTRACE(( "TEST WR-LOCK %d unlock reserved byte r=%d\n", pFile->h, rcu ));
23364 OSTRACE(( "TEST WR-LOCK %d %d (remote)\n", pFile->h, r ));
23383 os2File *pFile = (os2File*)id;
23390 assert( pFile!=0 );
23392 OSTRACE(( "UNLOCK %d to %d was %d\n", pFile->h, locktype, pFile->locktype ));
23393 type = pFile->locktype;
23399 res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
23400 OSTRACE(( "UNLOCK %d exclusive lock res=%d\n", pFile->h, res ));
23401 if( locktype==SHARED_LOCK && getReadLock(pFile) != NO_ERROR ){
23404 OSTRACE(( "UNLOCK %d to %d getReadLock() failed\n", pFile->h, locktype ));
23413 res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
23414 OSTRACE(( "UNLOCK %d reserved res=%d\n", pFile->h, res ));
23417 res = unlockReadLock(pFile);
23419 pFile->h, type, locktype, res ));
23426 res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
23427 OSTRACE(( "UNLOCK %d pending res=%d\n", pFile->h, res ));
23429 pFile->locktype = locktype;
23430 OSTRACE(( "UNLOCK %d now %d\n", pFile->h, pFile->locktype ));
23959 os2File *pFile = (os2File*)id;
23963 if( !pFile->pShmLink )
23964 rc = os2OpenSharedMemory( pFile, szRegion );
23967 pNode = pFile->pShmLink->pShmNode ;
24027 pFile->zFullPathCp, iRegion, szRegion, bExtend, rc))
24043 os2File *pFile = (os2File*)id;
24044 os2ShmLink *pLink = pFile->pShmLink;
24067 pFile->pShmLink = NULL;
24095 os2File *pFile = (os2File*)id;
24096 os2ShmLink *p = pFile->pShmLink; /* The shared memory being locked */
24352 os2File *pFile = (os2File*)id;
24400 memset( pFile, 0, sizeof(*pFile) );
24401 pFile->h = (HFILE)-1;
24474 pFile->zFullPathCp = convertUtf8PathToCp( zTmpname );
24475 pFile->pMethod = &os2IoMethod;
24476 pFile->flags = flags;
24477 pFile->h = h;
24480 OSTRACE(( "OPEN %d pOutFlags=%d\n", pFile->h, pOutFlags ));
26134 static void robust_close(unixFile *pFile, int h, int lineno){
26137 pFile ? pFile->zPath : 0, lineno);
26144 static void closePendingFds(unixFile *pFile){
26145 unixInodeInfo *pInode = pFile->pInode;
26150 robust_close(pFile, p->fd, __LINE__);
26162 static void releaseInodeInfo(unixFile *pFile){
26163 unixInodeInfo *pInode = pFile->pInode;
26169 closePendingFds(pFile);
26197 unixFile *pFile, /* Unix file with file desc used in the key */
26201 int fd; /* The file descriptor for pFile */
26211 fd = pFile->h;
26214 pFile->lastErrno = errno;
26216 if( pFile->lastErrno==EOVERFLOW ) return SQLITE_NOLFS;
26232 if( statbuf.st_size==0 && (pFile->fsFlags & SQLITE_FSFLAGS_IS_MSDOS)!=0 ){
26235 pFile->lastErrno = errno;
26240 pFile->lastErrno = errno;
26249 fileId.pId = pFile->pId;
26286 unixFile *pFile = (unixFile*)id;
26290 assert( pFile );
26291 unixEnterMutex(); /* Because pFile->pInode is shared across threads */
26294 if( pFile->pInode->eFileLock>SHARED_LOCK ){
26301 if( !reserved && !pFile->pInode->bProcessLock ){
26307 if( osFcntl(pFile->h, F_GETLK, &lock) ){
26309 pFile->lastErrno = errno;
26317 OSTRACE(("TEST WR-LOCK %d %d %d (unix)\n", pFile->h, rc, reserved));
26324 ** Attempt to set a system-lock on the file pFile. The lock is
26327 ** If the pFile was opened read/write from unix-excl, then the only lock
26335 ** This function is a pass-through to fcntl(F_SETLK) if pFile is using
26336 ** any VFS other than "unix-excl" or if pFile is opened on "unix-excl"
26342 static int unixFileLock(unixFile *pFile, struct flock *pLock){
26344 unixInodeInfo *pInode = pFile->pInode;
26347 if( ((pFile->ctrlFlags & UNIXFILE_EXCL)!=0 || pInode->bProcessLock)
26348 && ((pFile->ctrlFlags & UNIXFILE_RDONLY)==0)
26357 rc = osFcntl(pFile->h, F_SETLK, &lock);
26365 rc = osFcntl(pFile->h, F_SETLK, pLock);
26434 unixFile *pFile = (unixFile*)id;
26439 assert( pFile );
26440 OSTRACE(("LOCK %d %s was %s(%s,%d) pid=%d (unix)\n", pFile->h,
26441 azFileLock(eFileLock), azFileLock(pFile->eFileLock),
26442 azFileLock(pFile->pInode->eFileLock), pFile->pInode->nShared , getpid()));
26448 if( pFile->eFileLock>=eFileLock ){
26449 OSTRACE(("LOCK %d %s ok (already held) (unix)\n", pFile->h,
26459 assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK );
26461 assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );
26463 /* This mutex is needed because pFile->pInode is shared across threads
26466 pInode = pFile->pInode;
26471 if( (pFile->eFileLock!=pInode->eFileLock &&
26485 assert( pFile->eFileLock==0 );
26487 pFile->eFileLock = SHARED_LOCK;
26501 || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLock<PENDING_LOCK)
26505 if( unixFileLock(pFile, &lock) ){
26509 pFile->lastErrno = tErrno;
26527 if( unixFileLock(pFile, &lock) ){
26536 if( unixFileLock(pFile, &lock) && rc==SQLITE_OK ){
26544 pFile->lastErrno = tErrno;
26548 pFile->eFileLock = SHARED_LOCK;
26561 assert( 0!=pFile->eFileLock );
26573 if( unixFileLock(pFile, &lock) ){
26577 pFile->lastErrno = tErrno;
26590 && pFile->eFileLock<=SHARED_LOCK
26593 pFile->transCntrChng = 0;
26594 pFile->dbUpdate = 0;
26595 pFile->inNormalWrite = 1;
26601 pFile->eFileLock = eFileLock;
26604 pFile->eFileLock = PENDING_LOCK;
26610 OSTRACE(("LOCK %d %s %s (unix)\n", pFile->h, azFileLock(eFileLock),
26616 ** Add the file descriptor used by file handle pFile to the corresponding
26619 static void setPendingFd(unixFile *pFile){
26620 unixInodeInfo *pInode = pFile->pInode;
26621 UnixUnusedFd *p = pFile->pUnused;
26624 pFile->h = -1;
26625 pFile->pUnused = 0;
26629 ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
26642 unixFile *pFile = (unixFile*)id;
26647 assert( pFile );
26648 OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (unix)\n", pFile->h, eFileLock,
26649 pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,
26653 if( pFile->eFileLock<=eFileLock ){
26657 pInode = pFile->pInode;
26659 if( pFile->eFileLock>SHARED_LOCK ){
26660 assert( pInode->eFileLock==pFile->eFileLock );
26671 pFile->inNormalWrite = 0;
26698 if( unixFileLock(pFile, &lock)==(-1) ){
26702 pFile->lastErrno = tErrno;
26710 if( unixFileLock(pFile, &lock)==(-1) ){
26714 pFile->lastErrno = tErrno;
26722 if( unixFileLock(pFile, &lock)==(-1) ){
26726 pFile->lastErrno = tErrno;
26737 if( unixFileLock(pFile, &lock) ){
26745 pFile->lastErrno = errno;
26754 if( unixFileLock(pFile, &lock)==0 ){
26758 pFile->lastErrno = errno;
26772 if( unixFileLock(pFile, &lock)==0 ){
26776 pFile->lastErrno = errno;
26778 pFile->eFileLock = NO_LOCK;
26789 closePendingFds(pFile);
26795 if( rc==SQLITE_OK ) pFile->eFileLock = eFileLock;
26800 ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
26821 unixFile *pFile = (unixFile*)id;
26822 if( pFile->h>=0 ){
26823 robust_close(pFile, pFile->h, __LINE__);
26824 pFile->h = -1;
26827 if( pFile->pId ){
26828 if( pFile->ctrlFlags & UNIXFILE_DELETE ){
26829 osUnlink(pFile->pId->zCanonicalName);
26831 vxworksReleaseFileId(pFile->pId);
26832 pFile->pId = 0;
26835 OSTRACE(("CLOSE %-3d\n", pFile->h));
26837 sqlite3_free(pFile->pUnused);
26838 memset(pFile, 0, sizeof(unixFile));
26847 unixFile *pFile = (unixFile *)id;
26854 assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 );
26855 if( ALWAYS(pFile->pInode) && pFile->pInode->nLock ){
26861 setPendingFd(pFile);
26863 releaseInodeInfo(pFile);
26954 unixFile *pFile = (unixFile*)id;
26958 assert( pFile );
26961 if( pFile->eFileLock>SHARED_LOCK ){
26967 const char *zLockFile = (const char*)pFile->lockingContext;
26970 OSTRACE(("TEST WR-LOCK %d %d %d (dotlock)\n", pFile->h, rc, reserved));
27003 unixFile *pFile = (unixFile*)id;
27004 char *zLockFile = (char *)pFile->lockingContext;
27011 if( pFile->eFileLock > NO_LOCK ){
27012 pFile->eFileLock = eFileLock;
27032 pFile->lastErrno = tErrno;
27039 pFile->eFileLock = eFileLock;
27044 ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
27053 unixFile *pFile = (unixFile*)id;
27054 char *zLockFile = (char *)pFile->lockingContext;
27057 assert( pFile );
27058 OSTRACE(("UNLOCK %d %d was %d pid=%d (dotlock)\n", pFile->h, eFileLock,
27059 pFile->eFileLock, getpid()));
27063 if( pFile->eFileLock==eFileLock ){
27071 pFile->eFileLock = SHARED_LOCK;
27086 pFile->lastErrno = tErrno;
27090 pFile->eFileLock = NO_LOCK;
27100 unixFile *pFile = (unixFile*)id;
27102 sqlite3_free(pFile->lockingContext);
27150 unixFile *pFile = (unixFile*)id;
27154 assert( pFile );
27157 if( pFile->eFileLock>SHARED_LOCK ){
27164 int lrc = robust_flock(pFile->h, LOCK_EX | LOCK_NB);
27167 lrc = robust_flock(pFile->h, LOCK_UN);
27173 pFile->lastErrno = tErrno;
27183 pFile->lastErrno = tErrno;
27188 OSTRACE(("TEST WR-LOCK %d %d %d (flock)\n", pFile->h, rc, reserved));
27231 unixFile *pFile = (unixFile*)id;
27233 assert( pFile );
27237 if (pFile->eFileLock > NO_LOCK) {
27238 pFile->eFileLock = eFileLock;
27244 if (robust_flock(pFile->h, LOCK_EX | LOCK_NB)) {
27249 pFile->lastErrno = tErrno;
27253 pFile->eFileLock = eFileLock;
27255 OSTRACE(("LOCK %d %s %s (flock)\n", pFile->h, azFileLock(eFileLock),
27267 ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
27274 unixFile *pFile = (unixFile*)id;
27276 assert( pFile );
27277 OSTRACE(("UNLOCK %d %d was %d pid=%d (flock)\n", pFile->h, eFileLock,
27278 pFile->eFileLock, getpid()));
27282 if( pFile->eFileLock==eFileLock ){
27288 pFile->eFileLock = eFileLock;
27293 if( robust_flock(pFile->h, LOCK_UN) ){
27299 pFile->eFileLock = NO_LOCK;
27340 unixFile *pFile = (unixFile*)id;
27344 assert( pFile );
27347 if( pFile->eFileLock>SHARED_LOCK ){
27353 sem_t *pSem = pFile->pInode->pSem;
27360 pFile->lastErrno = tErrno;
27363 reserved = (pFile->eFileLock < SHARED_LOCK);
27370 OSTRACE(("TEST WR-LOCK %d %d %d (sem)\n", pFile->h, rc, reserved));
27406 unixFile *pFile = (unixFile*)id;
27408 sem_t *pSem = pFile->pInode->pSem;
27413 if (pFile->eFileLock > NO_LOCK) {
27414 pFile->eFileLock = eFileLock;
27426 pFile->eFileLock = eFileLock;
27433 ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
27440 unixFile *pFile = (unixFile*)id;
27441 sem_t *pSem = pFile->pInode->pSem;
27443 assert( pFile );
27445 OSTRACE(("UNLOCK %d %d was %d pid=%d (sem)\n", pFile->h, eFileLock,
27446 pFile->eFileLock, getpid()));
27450 if( pFile->eFileLock==eFileLock ){
27456 pFile->eFileLock = eFileLock;
27465 pFile->lastErrno = tErrno;
27469 pFile->eFileLock = NO_LOCK;
27478 unixFile *pFile = (unixFile*)id;
27480 assert( pFile );
27482 releaseInodeInfo(pFile);
27537 unixFile *pFile, /* Open file descriptor on path */
27549 pb.fd = pFile->h;
27552 (setLockFlag?"ON":"OFF"), pFile->h, (pb.fd==-1?"[testval-1]":""),
27567 pFile->lastErrno = tErrno;
27584 unixFile *pFile = (unixFile*)id;
27589 assert( pFile );
27590 context = (afpLockingContext *) pFile->lockingContext;
27595 unixEnterMutex(); /* Because pFile->pInode is shared across threads */
27598 if( pFile->pInode->eFileLock>SHARED_LOCK ){
27606 int lrc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1,1);
27610 lrc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1, 0);
27621 OSTRACE(("TEST WR-LOCK %d %d %d (afp)\n", pFile->h, rc, reserved));
27653 unixFile *pFile = (unixFile*)id;
27654 unixInodeInfo *pInode = pFile->pInode;
27655 afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;
27657 assert( pFile );
27658 OSTRACE(("LOCK %d %s was %s(%s,%d) pid=%d (afp)\n", pFile->h,
27659 azFileLock(eFileLock), azFileLock(pFile->eFileLock),
27666 if( pFile->eFileLock>=eFileLock ){
27667 OSTRACE(("LOCK %d %s ok (already held) (afp)\n", pFile->h,
27677 assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK );
27679 assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );
27681 /* This mutex is needed because pFile->pInode is shared across threads
27684 pInode = pFile->pInode;
27689 if( (pFile->eFileLock!=pInode->eFileLock &&
27703 assert( pFile->eFileLock==0 );
27705 pFile->eFileLock = SHARED_LOCK;
27716 || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLock<PENDING_LOCK)
27719 failed = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 1);
27741 lrc1 = afpSetLock(context->dbPath, pFile,
27744 lrc1Errno = pFile->lastErrno;
27747 lrc2 = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 0);
27750 pFile->lastErrno = lrc1Errno;
27759 pFile->eFileLock = SHARED_LOCK;
27773 assert( 0!=pFile->eFileLock );
27774 if (eFileLock >= RESERVED_LOCK && pFile->eFileLock < RESERVED_LOCK) {
27776 failed = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1,1);
27787 if( !(failed = afpSetLock(context->dbPath, pFile, SHARED_FIRST +
27791 failed = afpSetLock(context->dbPath, pFile, SHARED_FIRST,
27793 if( failed && (failed2 = afpSetLock(context->dbPath, pFile,
27812 pFile->eFileLock = eFileLock;
27815 pFile->eFileLock = PENDING_LOCK;
27821 OSTRACE(("LOCK %d %s %s (afp)\n", pFile->h, azFileLock(eFileLock),
27827 ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
27835 unixFile *pFile = (unixFile*)id;
27837 afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;
27840 int h = pFile->h;
27843 assert( pFile );
27844 OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (afp)\n", pFile->h, eFileLock,
27845 pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,
27849 if( pFile->eFileLock<=eFileLock ){
27853 pInode = pFile->pInode;
27855 if( pFile->eFileLock>SHARED_LOCK ){
27856 assert( pInode->eFileLock==pFile->eFileLock );
27870 assert( pFile->inNormalWrite==0
27871 || pFile->dbUpdate==0
27872 || pFile->transCntrChng==1 );
27873 pFile->inNormalWrite = 0;
27876 if( pFile->eFileLock==EXCLUSIVE_LOCK ){
27877 rc = afpSetLock(context->dbPath, pFile, SHARED_FIRST, SHARED_SIZE, 0);
27881 rc = afpSetLock(context->dbPath, pFile, sharedLockByte, 1, 1);
27886 if( rc==SQLITE_OK && pFile->eFileLock>=PENDING_LOCK ){
27887 rc = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 0);
27889 if( rc==SQLITE_OK && pFile->eFileLock>=RESERVED_LOCK && context->reserved ){
27890 rc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1, 0);
27912 rc = afpSetLock(context->dbPath, pFile, sharedLockByte, 1, 0);
27916 pFile->eFileLock = NO_LOCK;
27923 closePendingFds(pFile);
27929 if( rc==SQLITE_OK ) pFile->eFileLock = eFileLock;
27939 unixFile *pFile = (unixFile*)id;
27942 if( pFile->pInode && pFile->pInode->nLock ){
27948 setPendingFd(pFile);
27950 releaseInodeInfo(pFile);
27951 sqlite3_free(pFile->lockingContext);
27973 ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
28072 unixFile *pFile = (unixFile *)id;
28079 assert( pFile->pUnused==0
28085 got = seekAndRead(pFile, offset, pBuf, amt);
28092 pFile->lastErrno = 0; /* not a system error */
28151 unixFile *pFile = (unixFile*)id;
28159 assert( pFile->pUnused==0
28172 if( pFile->inNormalWrite ){
28173 pFile->dbUpdate = 1; /* The database has been modified */
28178 rc = seekAndRead(pFile, 24, oldCntr, 4);
28181 pFile->transCntrChng = 1; /* The transaction counter has changed */
28187 while( amt>0 && (wrote = seekAndWrite(pFile, offset, pBuf, amt))>0 ){
28196 if( wrote<0 && pFile->lastErrno!=ENOSPC ){
28200 pFile->lastErrno = 0; /* not a system error */
28392 unixFile *pFile = (unixFile*)id;
28407 assert( pFile );
28408 OSTRACE(("SYNC %-3d\n", pFile->h));
28409 rc = full_fsync(pFile->h, isFullsync, isDataOnly);
28412 pFile->lastErrno = errno;
28413 return unixLogError(SQLITE_IOERR_FSYNC, "full_fsync", pFile->zPath);
28420 if( pFile->ctrlFlags & UNIXFILE_DIRSYNC ){
28422 OSTRACE(("DIRSYNC %s (have_fullfsync=%d fullsync=%d)\n", pFile->zPath,
28424 rc = osOpenDirectory(pFile->zPath, &dirfd);
28427 robust_close(pFile, dirfd, __LINE__);
28431 pFile->ctrlFlags &= ~UNIXFILE_DIRSYNC;
28440 unixFile *pFile = (unixFile *)id;
28442 assert( pFile );
28450 if( pFile->szChunk ){
28451 nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk;
28454 rc = robust_ftruncate(pFile->h, (off_t)nByte);
28456 pFile->lastErrno = errno;
28457 return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
28467 if( pFile->inNormalWrite && nByte==0 ){
28468 pFile->transCntrChng = 1;
28517 static int fcntlSizeHint(unixFile *pFile, i64 nByte){
28518 if( pFile->szChunk>0 ){
28522 if( osFstat(pFile->h, &buf) ) {
28523 return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath);
28526 nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
28535 err = osFallocate(pFile->h, buf.st_size, nSize-buf.st_size);
28548 if( robust_ftruncate(pFile->h, nSize) ){
28549 pFile->lastErrno = errno;
28550 return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
28554 int nWrite = seekAndWrite(pFile, iWrite, "", 1);
28567 ** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set.
28569 ** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags.
28571 static void unixModeBit(unixFile *pFile, unsigned char mask, int *pArg){
28573 *pArg = (pFile->ctrlFlags & mask)!=0;
28575 pFile->ctrlFlags &= ~mask;
28577 pFile->ctrlFlags |= mask;
28585 unixFile *pFile = (unixFile*)id;
28588 *(int*)pArg = pFile->eFileLock;
28592 *(int*)pArg = pFile->lastErrno;
28596 pFile->szChunk = *(int *)pArg;
28602 rc = fcntlSizeHint(pFile, *(i64 *)pArg);
28607 unixModeBit(pFile, UNIXFILE_PERSIST_WAL, (int*)pArg);
28611 unixModeBit(pFile, UNIXFILE_PSOW, (int*)pArg);
28615 *(char**)pArg = sqlite3_mprintf("%s", pFile->pVfs->zName);
28649 static int unixSectorSize(sqlite3_file *pFile){
28650 (void)pFile;
28733 ** unixShm.pFile
28736 ** All other fields are read/write. The unixShm.pFile->mutex must be held
30044 sqlite3_file *pFile, /* The file descriptor to be filled in */
30048 unixFile *p = (unixFile *)pFile;
30223 ((unixFile*)pFile)->lastErrno = errno;
30228 ((unixFile*)pFile)->fsFlags |= SQLITE_FSFLAGS_IS_MSDOS;
30268 rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
30270 rc = proxyTransformUnixFile((unixFile*)pFile, ":auto:");
30274 ** pFile->pMethods will be NULL so sqlite3OsClose will be a no-op
30276 unixClose(pFile);
30285 rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
31023 static int proxyBreakConchLock(unixFile *pFile, uuid_t myHostID){
31024 proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
31065 robust_close(pFile, conchFile->h, __LINE__);
31073 robust_close(pFile
31083 static int proxyConchLock(unixFile *pFile, uuid_t myHostID, int lockType){
31084 proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
31103 pFile->lastErrno = errno;
31123 pFile->lastErrno = errno;
31140 if( 0==proxyBreakConchLock(pFile, myHostID) ){
31161 static int proxyTakeConch(unixFile *pFile){
31162 proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
31185 pFile->lastErrno = pError;
31188 rc = proxyConchLock(pFile, myHostID, SHARED_LOCK);
31196 pFile->lastErrno = conchFile->lastErrno;
31266 rc = proxyConchLock(pFile, myHostID, EXCLUSIVE_LOCK);
31291 int err = osFstat(pFile->h, &buf);
31320 OSTRACE(("TRANSPROXY: CLOSE %d\n", pFile->h));
31321 if( rc==SQLITE_OK && pFile->openFlags ){
31323 if( pFile->h>=0 ){
31324 robust_close(pFile, pFile->h, __LINE__);
31326 pFile->h = -1;
31327 fd = robust_open(pCtx->dbPath, pFile->openFlags, 0);
31330 pFile->h = fd;
31379 ** If pFile holds a lock on a conch file, then release that lock.
31381 static int proxyReleaseConch(unixFile *pFile){
31386 pCtx = (proxyLockingContext *)pFile->lockingContext;
31448 static int switchLockProxyPath(unixFile *pFile, const char *path) {
31449 proxyLockingContext *pCtx = (proxyLockingContext*)pFile->lockingContext;
31453 if( pFile->eFileLock!=NO_LOCK ){
31478 ** pFile is a file that has been opened by a prior xOpen call. dbPath
31481 ** This routine find the filename associated with pFile and writes it
31484 static int proxyGetDbPathForUnixFile(unixFile *pFile, char *dbPath){
31486 if( pFile->pMethod == &afpIoMethods ){
31489 assert( (int)strlen((char*)pFile->lockingContext)<=MAXPATHLEN );
31490 strlcpy(dbPath, ((afpLockingContext *)pFile->lockingContext)->dbPath, MAXPATHLEN);
31493 if( pFile->pMethod == &dotlockIoMethods ){
31496 int len = strlen((char *)pFile->lockingContext) - strlen(DOTLOCK_SUFFIX);
31497 memcpy(dbPath, (char *)pFile->lockingContext, len + 1);
31500 assert( strlen((char*)pFile->lockingContext)<=MAXPATHLEN );
31501 strlcpy(dbPath, (char *)pFile->lockingContext, MAXPATHLEN);
31514 static int proxyTransformUnixFile(unixFile *pFile, const char *path) {
31520 if( pFile->eFileLock!=NO_LOCK ){
31523 proxyGetDbPathForUnixFile(pFile, dbPath);
31530 OSTRACE(("TRANSPROXY %d for %s pid=%d\n", pFile->h,
31542 if( rc==SQLITE_CANTOPEN && ((pFile->openFlags&O_RDWR) == 0) ){
31578 pCtx->oldLockingContext = pFile->lockingContext;
31579 pFile->lockingContext = pCtx;
31580 pCtx->pOldMethod = pFile->pMethod;
31581 pFile->pMethod = &proxyIoMethods;
31591 OSTRACE(("TRANSPROXY %d %s\n", pFile->h,
31604 unixFile *pFile = (unixFile*)id;
31605 if( pFile->pMethod == &proxyIoMethods ){
31606 proxyLockingContext *pCtx = (proxyLockingContext*)pFile->lockingContext;
31607 proxyTakeConch(pFile);
31619 unixFile *pFile = (unixFile*)id;
31621 int isProxyStyle = (pFile->pMethod == &proxyIoMethods);
31634 (proxyLockingContext*)pFile->lockingContext;
31641 rc = switchLockProxyPath(pFile, proxyPath);
31645 rc = proxyTransformUnixFile(pFile, proxyPath);
31672 unixFile *pFile = (unixFile*)id;
31673 int rc = proxyTakeConch(pFile);
31675 proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
31711 unixFile *pFile = (unixFile*)id;
31712 int rc = proxyTakeConch(pFile);
31714 proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
31718 pFile->eFileLock = proxy->eFileLock;
31728 ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
31735 unixFile *pFile = (unixFile*)id;
31736 int rc = proxyTakeConch(pFile);
31738 proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
31742 pFile->eFileLock = proxy->eFileLock;
31755 unixFile *pFile = (unixFile*)id;
31756 proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
31771 rc = proxyReleaseConch(pFile);
31782 pFile->lockingContext = pCtx->oldLockingContext;
31783 pFile->pMethod = pCtx->pOldMethod;
31785 return pFile->pMethod->xClose(id);
33390 ** descriptor pFile
33392 static BOOL winceCreateLock(const char *zFilename, winFile *pFile){
33404 memset(&pFile->local, 0, sizeof(pFile->local));
33414 pFile->hMutex = osCreateMutexW(NULL, FALSE, zName);
33415 if (!pFile->hMutex){
33416 pFile->lastErrno = osGetLastError();
33417 winLogError(SQLITE_ERROR, pFile->lastErrno, "winceCreateLock1", zFilename);
33423 winceMutexAcquire(pFile->hMutex);
33430 pFile->hShared = osCreateFileMappingW(INVALID_HANDLE_VALUE, NULL,
33443 if (pFile->hShared){
33444 pFile->shared = (winceLock*)osMapViewOfFile(pFile->hShared,
33447 if (!pFile->shared){
33448 pFile->lastErrno = osGetLastError();
33449 winLogError(SQLITE_ERROR, pFile->lastErrno,
33451 osCloseHandle(pFile->hShared);
33452 pFile->hShared = NULL;
33457 if (pFile->hShared == NULL){
33458 winceMutexRelease(pFile->hMutex);
33459 osCloseHandle(pFile->hMutex);
33460 pFile->hMutex = NULL;
33466 memset(pFile->shared, 0, sizeof(winceLock));
33469 winceMutexRelease(pFile->hMutex);
33476 static void winceDestroyLock(winFile *pFile){
33477 if (pFile->hMutex){
33479 winceMutexAcquire(pFile->hMutex);
33483 if (pFile->local.nReaders){
33484 pFile->shared->nReaders --;
33486 if (pFile->local.bReserved){
33487 pFile->shared->bReserved = FALSE;
33489 if (pFile->local.bPending){
33490 pFile->shared->bPending = FALSE;
33492 if (pFile->local.bExclusive){
33493 pFile->shared->bExclusive = FALSE;
33497 osUnmapViewOfFile(pFile->shared);
33498 osCloseHandle(pFile->hShared);
33501 winceMutexRelease(pFile->hMutex);
33502 osCloseHandle(pFile->hMutex);
33503 pFile->hMutex = NULL;
33517 winFile *pFile = HANDLE_TO_WINFILE(phFile);
33523 if (!pFile->hMutex) return TRUE;
33524 winceMutexAcquire(pFile->hMutex);
33529 if (pFile->shared->nReaders == 0 && pFile->shared->bExclusive == 0){
33530 pFile->shared->bExclusive = TRUE;
33531 pFile->local.bExclusive = TRUE;
33539 if (pFile->shared->bExclusive == 0){
33540 pFile->local.nReaders ++;
33541 if (pFile->local.nReaders == 1){
33542 pFile->shared->nReaders ++;
33551 if (pFile->shared->bPending == 0) {
33552 pFile->shared->bPending = TRUE;
33553 pFile->local.bPending = TRUE;
33560 if (pFile->shared->bReserved == 0) {
33561 pFile->shared->bReserved = TRUE;
33562 pFile->local.bReserved = TRUE;
33567 winceMutexRelease(pFile->hMutex);
33581 winFile *pFile = HANDLE_TO_WINFILE(phFile);
33587 if (!pFile->hMutex) return TRUE;
33588 winceMutexAcquire(pFile->hMutex);
33593 if (pFile->local.bExclusive){
33595 pFile->local.bExclusive = FALSE;
33596 pFile->shared->bExclusive = FALSE;
33601 else if (pFile->local.nReaders){
33603 pFile->local.nReaders --;
33604 if (pFile->local.nReaders == 0)
33606 pFile->shared->nReaders --;
33614 if (pFile->local.bPending){
33615 pFile->local.bPending = FALSE;
33616 pFile->shared->bPending = FALSE;
33622 if (pFile->local.bReserved) {
33623 pFile->local.bReserved = FALSE;
33624 pFile->shared->bReserved = FALSE;
33629 winceMutexRelease(pFile->hMutex);
33676 ** Otherwise, set pFile->lastErrno and return non-zero.
33678 static int seekWinFile(winFile *pFile, sqlite3_int64 iOffset){
33694 dwRet = osSetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);
33698 pFile->lastErrno = lastErrno;
33699 winLogError(SQLITE_IOERR_SEEK, pFile->lastErrno,
33700 "seekWinFile", pFile->zPath);
33720 winFile *pFile = (winFile*)id;
33723 assert( pFile->pShm==0 );
33724 OSTRACE(("CLOSE %d\n", pFile->h));
33726 rc = osCloseHandle(pFile->h);
33731 winceDestroyLock(pFile);
33732 if( pFile->zDeleteOnClose ){
33735 osDeleteFileW(pFile->zDeleteOnClose)==0
33736 && osGetFileAttributesW(pFile->zDeleteOnClose)!=0xffffffff
33741 sqlite3_free(pFile->zDeleteOnClose);
33744 OSTRACE(("CLOSE %d %s\n", pFile->h, rc ? "ok" : "failed"));
33748 "winClose", pFile->zPath);
33762 winFile *pFile = (winFile*)id; /* file handle */
33768 OSTRACE(("READ %d lock=%d\n", pFile->h, pFile->locktype));
33770 if( seekWinFile(pFile, offset) ){
33773 while( !osReadFile(pFile->h, pBuf, amt, &nRead, 0) ){
33776 pFile->lastErrno = lastErrno;
33777 return winLogError(SQLITE_IOERR_READ, pFile->lastErrno,
33778 "winRead", pFile->zPath);
33801 winFile *pFile = (winFile*)id; /* File handle */
33805 assert( pFile );
33809 OSTRACE(("WRITE %d lock=%d\n", pFile->h, pFile->locktype));
33811 rc = seekWinFile(pFile, offset);
33819 if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, 0) ){
33828 pFile->lastErrno = lastErrno;
33834 if( ( pFile->lastErrno==ERROR_HANDLE_DISK_FULL )
33835 || ( pFile->lastErrno==ERROR_DISK_FULL )){
33838 return winLogError(SQLITE_IOERR_WRITE, pFile->lastErrno,
33839 "winWrite", pFile->zPath);
33850 winFile *pFile = (winFile*)id; /* File handle object */
33853 assert( pFile );
33855 OSTRACE(("TRUNCATE %d %lld\n", pFile->h, nByte));
33863 if( pFile->szChunk>0 ){
33864 nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk;
33868 if( seekWinFile(pFile, nByte) ){
33869 rc = winLogError(SQLITE_IOERR_TRUNCATE, pFile->lastErrno,
33870 "winTruncate1", pFile->zPath);
33871 }else if( 0==osSetEndOfFile(pFile->h) ){
33872 pFile->lastErrno = osGetLastError();
33873 rc = winLogError(SQLITE_IOERR_TRUNCATE, pFile->lastErrno,
33874 "winTruncate2", pFile->zPath);
33877 OSTRACE(("TRUNCATE %d %lld %s\n", pFile->h, nByte, rc ? "failed" : "ok"));
33906 winFile *pFile = (winFile*)id;
33911 assert( pFile );
33917 OSTRACE(("SYNC %d lock=%d\n", pFile->h, pFile->locktype));
33939 rc = osFlushFileBuffers(pFile->h);
33944 pFile->lastErrno = osGetLastError();
33945 return winLogError(SQLITE_IOERR_FSYNC, pFile->lastErrno,
33946 "winSync", pFile->zPath);
33957 winFile *pFile = (winFile*)id;
33962 lowerBits = osGetFileSize(pFile->h, &upperBits);
33966 pFile->lastErrno = lastErrno;
33967 return winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
33968 "winFileSize", pFile->zPath);
33986 static int getReadLock(winFile *pFile){
33993 res = osLockFileEx(pFile->h, LOCKFILE_FAIL_IMMEDIATELY,
34001 pFile->sharedLockByte = (short)((lk & 0x7fffffff)%(SHARED_SIZE - 1));
34002 res = osLockFile(pFile->h, SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0);
34006 pFile->lastErrno = osGetLastError();
34015 static int unlockReadLock(winFile *pFile){
34019 res = osUnlockFile(pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0);
34024 res = osUnlockFile(pFile->h, SHARED_FIRST + pFile->sharedLockByte, 0, 1, 0);
34028 pFile->lastErrno = lastErrno;
34029 winLogError(SQLITE_IOERR_UNLOCK, pFile->lastErrno,
34030 "unlockReadLock", pFile->zPath);
34064 int newLocktype; /* Set pFile->locktype to this value before exiting */
34066 winFile *pFile = (winFile*)id;
34071 pFile->h, locktype, pFile->locktype, pFile->sharedLockByte));
34077 if( pFile->locktype>=locktype ){
34083 assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );
34085 assert( locktype!=RESERVED_LOCK || pFile->locktype==SHARED_LOCK );
34091 newLocktype = pFile->locktype;
34092 if( (pFile->locktype==NO_LOCK)
34094 && (pFile->locktype==RESERVED_LOCK))
34097 while( cnt-->0 && (res = osLockFile(pFile->h, PENDING_BYTE, 0, 1, 0))==0 ){
34116 assert( pFile->locktype==NO_LOCK );
34117 res = getReadLock(pFile);
34128 assert( pFile->locktype==SHARED_LOCK );
34129 res = osLockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);
34147 assert( pFile->locktype>=SHARED_LOCK );
34148 res = unlockReadLock(pFile);
34150 res = osLockFile(pFile
34156 getReadLock(pFile);
34164 osUnlockFile(pFile->h, PENDING_BYTE, 0, 1, 0);
34173 OSTRACE(("LOCK FAILED %d trying for %d but got %d\n", pFile->h,
34175 pFile->lastErrno = lastErrno;
34178 pFile->locktype = (u8)newLocktype;
34189 winFile *pFile = (winFile*)id;
34194 if( pFile->locktype>=RESERVED_LOCK ){
34196 OSTRACE(("TEST WR-LOCK %d %d (local)\n", pFile->h, rc));
34198 rc = osLockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);
34200 osUnlockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);
34203 OSTRACE(("TEST WR-LOCK %d %d (remote)\n", pFile->h, rc));
34222 winFile *pFile = (winFile*)id;
34224 assert( pFile!=0 );
34226 OSTRACE(("UNLOCK %d to %d was %d(%d)\n", pFile->h, locktype,
34227 pFile->locktype, pFile->sharedLockByte));
34228 type = pFile->locktype;
34230 osUnlockFile(pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0);
34231 if( locktype==SHARED_LOCK && !getReadLock(pFile) ){
34235 "winUnlock", pFile->zPath);
34239 osUnlockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);
34242 unlockReadLock(pFile);
34245 osUnlockFile(pFile->h, PENDING_BYTE, 0, 1, 0);
34247 pFile->locktype = (u8)locktype;
34253 ** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set.
34255 ** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags.
34257 static void winModeBit(winFile *pFile, unsigned char mask, int *pArg){
34259 *pArg = (pFile->ctrlFlags & mask)!=0;
34261 pFile->ctrlFlags &= ~mask;
34263 pFile->ctrlFlags |= mask;
34271 winFile *pFile = (winFile*)id;
34274 *(int*)pArg = pFile->locktype;
34278 *(int*)pArg = (int)pFile->lastErrno;
34282 pFile->szChunk = *(int *)pArg;
34286 if( pFile->szChunk>0 ){
34302 winModeBit(pFile, WINFILE_PERSIST_WAL, (int*)pArg);
34306 winModeBit(pFile, WINFILE_PSOW, (int*)pArg);
34478 winShmNode *pFile, /* Apply locks to this open shared-memory segment */
34488 assert( sqlite3_mutex_held(pFile->mutex) || pFile->nRef==0 );
34499 rc = osUnlockFileEx(pFile->hFile.h, 0, nByte, 0, &ovlp);
34501 rc = osLockFileEx(pFile->hFile.h, dwFlags, 0, nByte, 0, &ovlp);
34507 pFile->lastErrno = osGetLastError();
34512 pFile->hFile.h,
34515 pFile->lastErrno));
35140 winFile *pFile = (winFile*)id;
35200 pFile->h = INVALID_HANDLE_VALUE;
35300 pFile->lastErrno = lastErrno;
35301 winLogError(SQLITE_CANTOPEN, pFile->lastErrno, "winOpen", zUtf8Name);
35319 memset(pFile, 0, sizeof(*pFile));
35320 pFile->pMethod = &winIoMethod;
35321 pFile->h = h;
35322 pFile->lastErrno = NO_ERROR;
35323 pFile->pVfs = pVfs;
35324 pFile->pShm = 0;
35325 pFile->zPath = zName;
35327 pFile->ctrlFlags |= WINFILE_PSOW;
35332 && !winceCreateLock(zName, pFile)
35339 pFile->zDeleteOnClose = zConverted;
41837 ** Write the file descriptor into *pFile. Return SQLITE_OK on success
41851 sqlite3_file *pFile, /* Write the file descriptor here */
41862 rc = sqlite3OsOpen(pPager->pVfs, 0, pFile, vfsFlags, 0);
41863 assert( rc!=SQLITE_OK || isOpen(pFile) );
57941 ** If pFile is currently larger than iSize bytes, then truncate it to
57942 ** exactly iSize bytes. If pFile is not larger than iSize bytes, then
57948 static int backupTruncateFile(sqlite3_file *pFile, i64 iSize){
57950 int rc = sqlite3OsFileSize(pFile, &iCurrent);
57952 rc = sqlite3OsTruncate(pFile, iSize);
58108 sqlite3_file * const pFile = sqlite3PagerFile(pDestPager);
58112 assert( pFile );
58138 rc = sqlite3OsWrite(pFile, zData, pgszSrc, iOff);
58143 rc = backupTruncateFile(pFile, iSize);
71768 ** variables nKey/aKey. If the iterator is at EOF, pFile==0.
71775 sqlite3_file *pFile; /* File iterator is reading from */
71831 rc = sqlite3OsRead(pIter->pFile, pIter->aAlloc, nRead, pIter->iReadOff);
71846 pIter->pFile, &pIter->aAlloc[nRead], nRead2, pIter->iReadOff+nRead
71859 ** Write a single varint, value iVal, to file-descriptor pFile. Return
71863 ** offset in file pFile to write to. Before returning, *piOffset is
71867 sqlite3_file *pFile, /* File to write to */
71869 i64 *piOffset /* IN/OUT: Write offset in file pFile */
71876 rc = sqlite3OsWrite(pFile, aVarint, nVarint, *piOffset);
71883 ** Read a single varint from file-descriptor pFile. Return SQLITE_OK if
71887 ** byte offset in file pFile from whence to read the varint. If successful
71894 sqlite3_file *pFile, /* File to read from */
71895 i64 *piOffset, /* IN/OUT: Read offset in pFile */
71902 rc = sqlite3OsRead(pFile, aVarint, 9, iOff);
71911 ** Initialize iterator pIter to scan through the PMA stored in file pFile
71919 i64 iStart, /* Start offset in pFile */
71927 pIter->pFile = pSorter->pTemp1;
72018 if( p1->pFile==0 ){
72020 }else if( p2->pFile==0 ){
72397 assert( rc!=SQLITE_OK || pSorter->aIter[ pSorter->aTree[1] ].pFile );
72417 assert( pIter->pFile );
72444 *pbEof = (pSorter->aIter[pSorter->aTree[1]].pFile==0);
72464 *pbEof = (pSorter->aIter[pSorter->aTree[1]].pFile==0);
92903 sqlite3_file *pFile = sqlite3PagerFile(pPager);
92904 sqlite3OsFileControlHint(pFile, SQLITE_GET_LOCKPROXYFILE,
92916 sqlite3_file *pFile = sqlite3PagerFile(pPager);
92919 res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE,
92922 res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE,