Lines Matching refs:pFd
40485 static int unixMapfile(unixFile *pFd, i64 nByte);
40486 static void unixUnmapfile(unixFile *pFd);
42071 ** If successful, *pFd is set to the opened file descriptor and
42073 ** or SQLITE_CANTOPEN is returned and *pFd is set to an undefined
42087 ** *pFd set to a negative number.
42090 ** the file descriptor *pFd using close().
42092 static int openDirectory(const char *zFilename, int *pFd){
42109 *pFd = fd;
42487 ** If pFd->sectorSize is non-zero when this function is called, it is a
42488 ** no-op. Otherwise, the values of pFd->sectorSize and
42489 ** pFd->deviceCharacteristics are set according to the file-system
42496 static void setDeviceCharacteristics(unixFile *pFd){
42497 assert( pFd->deviceCharacteristics==0 || pFd->sectorSize!=0 );
42498 if( pFd->sectorSize==0 ){
42504 res = osIoctl(pFd->h, F2FS_IOC_GET_FEATURES, &f);
42506 pFd->deviceCharacteristics = SQLITE_IOCAP_BATCH_ATOMIC;
42511 if( pFd->ctrlFlags & UNIXFILE_PSOW ){
42512 pFd->deviceCharacteristics |= SQLITE_IOCAP_POWERSAFE_OVERWRITE;
42515 pFd->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE;
42604 unixFile *pFd = (unixFile*)id;
42605 setDeviceCharacteristics(pFd);
42606 return pFd->sectorSize;
42623 unixFile *pFd = (unixFile*)id;
42624 setDeviceCharacteristics(pFd);
42625 return pFd->deviceCharacteristics;
42894 static void unixShmPurge(unixFile *pFd){
42895 unixShmNode *p = pFd->pInode->pShmNode;
42900 assert( p->pInode==pFd->pInode );
42916 robust_close(pFd, p->hShm, __LINE__);
43642 ** If it is currently memory mapped, unmap file pFd.
43644 static void unixUnmapfile(unixFile *pFd){
43645 assert( pFd->nFetchOut==0 );
43646 if( pFd->pMapRegion ){
43647 osMunmap(pFd->pMapRegion, pFd->mmapSizeActual);
43648 pFd->pMapRegion = 0;
43649 pFd->mmapSize = 0;
43650 pFd->mmapSizeActual = 0;
43656 ** descriptor pFd to nNew bytes. Any existing mapping is discarded.
43670 unixFile *pFd, /* File descriptor object */
43674 int h = pFd->h; /* File descriptor open on db file */
43675 u8 *pOrig = (u8 *)pFd->pMapRegion; /* Pointer to current file mapping */
43676 i64 nOrig = pFd->mmapSizeActual; /* Size of pOrig region in bytes */
43680 assert( pFd->nFetchOut==0 );
43681 assert( nNew>pFd->mmapSize );
43682 assert( nNew<=pFd->mmapSizeMax );
43684 assert( pFd->mmapSizeActual>=pFd->mmapSize );
43688 if( (pFd->ctrlFlags & UNIXFILE_RDONLY)==0 ) flags |= PROT_WRITE;
43693 i64 nReuse = pFd->mmapSize;
43696 i64 nReuse = (pFd->mmapSize & ~(szSyspage-1));
43734 unixLogError(SQLITE_OK, zErr, pFd->zPath);
43739 pFd->mmapSizeMax = 0;
43741 pFd->pMapRegion = (void *)pNew;
43742 pFd->mmapSize = pFd->mmapSizeActual = nNew;
43746 ** Memory map or remap the file opened by file-descriptor pFd (if the file
43761 static int unixMapfile(unixFile *pFd, i64 nMap){
43762 assert( nMap>=0 || pFd->nFetchOut==0 );
43763 assert( nMap>0 || (pFd->mmapSize==0 && pFd->pMapRegion==0) );
43764 if( pFd->nFetchOut>0 ) return SQLITE_OK;
43768 if( osFstat(pFd->h, &statbuf) ){
43773 if( nMap>pFd->mmapSizeMax ){
43774 nMap = pFd->mmapSizeMax;
43777 assert( nMap>0 || (pFd->mmapSize==0 && pFd->pMapRegion==0) );
43778 if( nMap!=pFd->mmapSize ){
43779 unixRemapfile(pFd, nMap);
43800 unixFile *pFd = (unixFile *)fd; /* The underlying database file */
43805 if( pFd->mmapSizeMax>0 ){
43811 if( pFd->pMapRegion==0 ){
43812 int rc = unixMapfile(pFd, -1);
43815 if( pFd->mmapSize >= (iOff+nAmt+nEofBuffer) ){
43816 *pp = &((u8 *)pFd->pMapRegion)[iOff];
43817 pFd->nFetchOut++;
43836 unixFile *pFd = (unixFile *)fd; /* The underlying database file */
43842 assert( (p==0)==(pFd->nFetchOut==0) );
43845 assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] );
43848 pFd->nFetchOut--;
43850 unixUnmapfile(pFd);
43853 assert( pFd->nFetchOut>=0 );
51051 ** Memory map or remap the file opened by file-descriptor pFd (if the file
51066 static int winMapfile(winFile *pFd, sqlite3_int64 nByte){
51070 assert( nMap>=0 || pFd->nFetchOut==0 );
51072 osGetCurrentProcessId(), pFd, nByte));
51074 if( pFd->nFetchOut>0 ) return SQLITE_OK;
51077 rc = winFileSize((sqlite3_file*)pFd, &nMap);
51080 osGetCurrentProcessId(), pFd));
51084 if( nMap>pFd->mmapSizeMax ){
51085 nMap = pFd->mmapSizeMax;
51089 if( nMap==0 && pFd->mmapSize>0 ){
51090 winUnmapfile(pFd);
51092 if( nMap!=pFd->mmapSize ){
51097 winUnmapfile(pFd);
51099 if( (pFd->ctrlFlags & WINFILE_RDONLY)==0 ){
51105 pFd->hMap = osCreateFileMappingFromApp(pFd->h, NULL, protect, nMap, NULL);
51107 pFd->hMap = osCreateFileMappingW(pFd->h, NULL, protect,
51111 pFd->hMap = osCreateFileMappingA(pFd->h, NULL, protect,
51115 if( pFd->hMap==NULL ){
51116 pFd->lastErrno = osGetLastError();
51117 rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno,
51118 "winMapfile1", pFd->zPath);
51121 osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
51127 pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap);
51129 pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap);
51132 osCloseHandle(pFd->hMap);
51133 pFd->hMap = NULL;
51134 pFd->lastErrno = osGetLastError();
51135 rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno,
51136 "winMapfile2", pFd->zPath);
51139 osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
51142 pFd->pMapRegion = pNew;
51143 pFd->mmapSize = nMap;
51147 osGetCurrentProcessId(), pFd));
51166 winFile *pFd = (winFile*)fd; /* The underlying database file */
51174 if( pFd->mmapSizeMax>0 ){
51180 if( pFd->pMapRegion==0 ){
51181 int rc = winMapfile(pFd, -1);
51184 osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
51188 if( pFd->mmapSize >= (iOff+nAmt+nEofBuffer) ){
51189 assert( pFd->pMapRegion!=0 );
51190 *pp = &((u8 *)pFd->pMapRegion)[iOff];
51191 pFd->nFetchOut++;
51213 winFile *pFd = (winFile*)fd; /* The underlying database file */
51218 assert( (p==0)==(pFd->nFetchOut==0) );
51221 assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] );
51224 osGetCurrentProcessId(), pFd, iOff, p));
51227 pFd->nFetchOut--;
51233 winUnmapfile(pFd);
51236 assert( pFd->nFetchOut>=0 );
53410 sqlite3_file *pFd,
53414 MemFile *pFile = (MemFile*)pFd;
53481 pFd->pMethods = &memdb_io_methods;
57912 #define isOpen(pFd) ((pFd)->pMethods!=0)
68788 sqlite3_file *pFd; /* The WAL file to which we write */
68811 rc = sqlite3OsWrite(p->pFd, pContent, iFirstAmt, iOffset);
68817 rc = sqlite3OsSync(p->pFd, WAL_SYNC_FLAGS(p->syncFlags));
68820 rc = sqlite3OsWrite(p->pFd, pContent, iAmt, iOffset);
68996 w.pFd = pWal->pWalFd;
69076 rc = sqlite3OsSync(w.pFd, WAL_SYNC_FLAGS(sync_flags));
82732 sqlite3_file *pFd; /* File descriptor for database pTo */
82738 pFd = sqlite3PagerFile(sqlite3BtreePager(pTo));
82739 if( pFd->pMethods ){
82741 rc = sqlite3OsFileControl(pFd, SQLITE_FCNTL_OVERWRITE, &nByte);
102975 sqlite3_file *pFd; /* File handle */
102976 i64 iEof; /* Bytes of data stored in pFd */
103149 ** pFd==0 at EOF.
103156 sqlite3_file *pFd; /* File handle we are reading from */
103222 sqlite3_file *pFd; /* File handle to write to */
103273 if( pReadr->aMap ) sqlite3OsUnfetch(pReadr->pFd, 0, pReadr->aMap);
103320 rc = sqlite3OsRead(p->pFd, p->aBuffer, nRead, p->iReadOff);
103417 sqlite3_file *pFd = pFile->pFd;
103418 if( pFd->pMethods->iVersion>=3 ){
103419 rc = sqlite3OsFetch(pFd, 0, (int)pFile->iEof, (void**)pp);
103443 sqlite3OsUnfetch(pReadr->pFd, 0, pReadr->aMap);
103448 pReadr->pFd = pFile->pFd;
103465 pReadr->pFd, &pReadr->aBuffer[iBuf], nRead, pReadr->iReadOff
103861 if( pTask->file.pFd ){
103862 sqlite3OsCloseFree(pTask->file.pFd);
103864 if( pTask->file2.pFd ){
103865 sqlite3OsCloseFree(pTask->file2.pFd);
104020 if( pIncr->aFile[0].pFd ) sqlite3OsCloseFree(pIncr->aFile[0].pFd);
104021 if( pIncr->aFile[1].pFd ) sqlite3OsCloseFree(pIncr->aFile[1].pFd);
104087 static void vdbeSorterExtendFile(sqlite3 *db, sqlite3_file *pFd, i64 nByte){
104088 if( nByte<=(i64)(db->nMaxSorterMmap) && pFd->pMethods->iVersion>=3 ){
104091 sqlite3OsFileControlHint(pFd, SQLITE_FCNTL_CHUNK_SIZE, &chunksize);
104092 sqlite3OsFileControlHint(pFd, SQLITE_FCNTL_SIZE_HINT, &nByte);
104093 sqlite3OsFetch(pFd, 0, (int)nByte, &p);
104094 if( p ) sqlite3OsUnfetch(pFd, 0, p);
104255 sqlite3_file *pFd, /* File handle to write to */
104258 i64 iStart /* Offset of pFd to begin writing at */
104268 p->pFd = pFd;
104287 p->eFWErr = sqlite3OsWrite(p->pFd,
104312 p->eFWErr = sqlite3OsWrite(p->pFd,
104365 if( pTask->file.pFd==0 ){
104366 rc = vdbeSorterOpenTempFile(db, 0, &pTask->file.pFd);
104367 assert( rc!=SQLITE_OK || pTask->file.pFd );
104374 vdbeSorterExtendFile(db, pTask->file.pFd, pTask->file.iEof+pList->szPMA+9);
104386 vdbePmaWriterInit(pTask->file.pFd, &writer, pTask->pSorter->pgsz,
104439 if( pReadr1->pFd==0 ){
104441 }else if( pReadr2->pFd==0 ){
104469 if( pReadr1->pFd ) bCached = 0;
104474 *pbEof = (pMerger->aReadr[pMerger->aTree[1]].pFd==0);
104692 vdbePmaWriterInit(pOut->pFd, &writer, pTask->pSorter->pgsz, iStart);
104701 if( pReader->pFd==0 ) break;
104856 if( p1->pFd==0 ){
104858 }else if( p2->pFd==0 ){
105009 rc = vdbeSorterOpenTempFile(db, mxSz, &pIncr->aFile[0].pFd);
105011 rc = vdbeSorterOpenTempFile(db, mxSz, &pIncr->aFile[1].pFd);
105016 if( pTask->file2.pFd==0 ){
105018 rc = vdbeSorterOpenTempFile(db, pTask->file2.iEof, &pTask->file2.pFd);
105022 pIncr->aFile[1].pFd = pTask->file2.pFd;
105449 if( rc==SQLITE_OK && pSorter->pReader->pFd==0 ) rc = SQLITE_DONE;
221658 rbu_file *pFd = (rbuIsVacuum(p) ? p->pRbuFd : p->pTargetFd);
221682 RBU_STATE_COOKIE, (i64)pFd->iCookie,
222187 rbu_file *pFd = (rbuIsVacuum(p) ? p->pRbuFd : p->pTargetFd);
222188 if( pFd->iCookie!=pState->iCookie ){
222637 static int rbuUpdateTempSize(rbu_file *pFd, sqlite3_int64 nNew){
222638 sqlite3rbu *pRbu = pFd->pRbu;
222639 i64 nDiff = nNew - pFd->sz;
222641 pFd->sz = nNew;
222807 sqlite3_file *pFd = (sqlite3_file*)pRbu->pRbuFd;
222808 rc = pFd->pMethods->xRead(pFd, zBuf, iAmt, iOfst);
223212 rbu_file *pFd = (rbu_file *)pFile;
223217 memset(pFd, 0, sizeof(rbu_file));
223218 pFd->pReal = (sqlite3_file*)&pFd[1];
223219 pFd->pRbuVfs = pRbuVfs;
223220 pFd->openFlags = flags;
223224 ** (pFd->zWal) to point to a buffer owned by SQLite that contains
223228 pFd->zWal = sqlite3_filename_wal(zName);
223242 pFd->pRbu = pDb->pRbu;
223244 pDb->pWalFd = pFd;
223248 pFd->pRbu = pRbuVfs->pRbu;
223261 rc = pRealVfs->xOpen(pRealVfs, zOpen, pFd->pReal, oflags, pOutFlags);
223263 if( pFd->pReal->pMethods ){
223264 const sqlite3_io_methods *pMeth = pFd->pReal->pMethods;
223274 rbuMainlistAdd(pFd);
223277 sqlite3_free(pFd->zDel);