Home | History | Annotate | Download | only in dist

Lines Matching refs:pFd

26176 static int unixMapfile(unixFile *pFd, i64 nByte);
26177 static void unixUnmapfile(unixFile *pFd);
27769 ** If successful, *pFd is set to the opened file descriptor and
27771 ** or SQLITE_CANTOPEN is returned and *pFd is set to an undefined
27785 ** *pFd set to a negative number.
27788 ** the file descriptor *pFd using close().
27790 static int openDirectory(const char *zFilename, int *pFd){
27804 *pFd = fd;
28445 static void unixShmPurge(unixFile *pFd){
28446 unixShmNode *p = pFd->pInode->pShmNode;
28451 assert( p->pInode==pFd->pInode );
28462 robust_close(pFd, p->h, __LINE__);
28965 ** If it is currently memory mapped, unmap file pFd.
28967 static void unixUnmapfile(unixFile *pFd){
28968 assert( pFd->nFetchOut==0 );
28969 if( pFd->pMapRegion ){
28970 osMunmap(pFd->pMapRegion, pFd->mmapSizeActual);
28971 pFd->pMapRegion = 0;
28972 pFd->mmapSize = 0;
28973 pFd->mmapSizeActual = 0;
28979 ** descriptor pFd to nNew bytes. Any existing mapping is discarded.
28993 unixFile *pFd
28997 int h = pFd->h; /* File descriptor open on db file */
28998 u8 *pOrig = (u8 *)pFd->pMapRegion; /* Pointer to current file mapping */
28999 i64 nOrig = pFd->mmapSizeActual; /* Size of pOrig region in bytes */
29003 assert( pFd->nFetchOut==0 );
29004 assert( nNew>pFd->mmapSize );
29005 assert( nNew<=pFd->mmapSizeMax );
29007 assert( pFd->mmapSizeActual>=pFd->mmapSize );
29010 if( (pFd->ctrlFlags & UNIXFILE_RDONLY)==0 ) flags |= PROT_WRITE;
29014 i64 nReuse = pFd->mmapSize;
29017 i64 nReuse = (pFd->mmapSize & ~(szSyspage-1));
29055 unixLogError(SQLITE_OK, zErr, pFd->zPath);
29060 pFd->mmapSizeMax = 0;
29062 pFd->pMapRegion = (void *)pNew;
29063 pFd->mmapSize = pFd->mmapSizeActual = nNew;
29067 ** Memory map or remap the file opened by file-descriptor pFd (if the file
29082 static int unixMapfile(unixFile *pFd, i64 nByte){
29086 assert( nMap>=0 || pFd->nFetchOut==0 );
29087 if( pFd->nFetchOut>0 ) return SQLITE_OK;
29091 rc = osFstat(pFd->h, &statbuf);
29097 if( nMap>pFd->mmapSizeMax ){
29098 nMap = pFd->mmapSizeMax;
29101 if( nMap!=pFd->mmapSize ){
29103 unixRemapfile(pFd, nMap);
29105 unixUnmapfile(pFd);
29127 unixFile *pFd = (unixFile *)fd; /* The underlying database file */
29132 if( pFd->mmapSizeMax>0 ){
29133 if( pFd->pMapRegion==0 ){
29134 int rc = unixMapfile(pFd, -1);
29137 if( pFd->mmapSize >= iOff+nAmt ){
29138 *pp = &((u8 *)pFd->pMapRegion)[iOff];
29139 pFd->nFetchOut++;
29158 unixFile *pFd = (unixFile *)fd; /* The underlying database file */
29164 assert( (p==0)==(pFd->nFetchOut==0) );
29167 assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] );
29170 pFd->nFetchOut--;
29172 unixUnmapfile(pFd);
29175 assert( pFd->nFetchOut>=0 );
35961 ** Memory map or remap the file opened by file-descriptor pFd (if the file
35976 static int winMapfile(winFile *pFd, sqlite3_int64 nByte){
35980 assert( nMap>=0 || pFd->nFetchOut==0 );
35982 osGetCurrentProcessId(), pFd, nByte));
35984 if( pFd->nFetchOut>0 ) return SQLITE_OK;
35987 rc = winFileSize((sqlite3_file*)pFd, &nMap);
35990 osGetCurrentProcessId(), pFd));
35994 if( nMap>pFd->mmapSizeMax ){
35995 nMap = pFd->mmapSizeMax;
35999 if( nMap==0 && pFd->mmapSize>0 ){
36000 winUnmapfile(pFd);
36002 if( nMap!=pFd->mmapSize ){
36007 winUnmapfile(pFd);
36008 if( (pFd->ctrlFlags & WINFILE_RDONLY)==0 ){
36013 pFd->hMap = osCreateFileMappingFromApp(pFd->h, NULL, protect, nMap, NULL);
36015 pFd->hMap = osCreateFileMappingW(pFd->h, NULL, protect,
36019 pFd->hMap = osCreateFileMappingA(pFd->h, NULL, protect,
36023 if( pFd->hMap==NULL ){
36024 pFd->lastErrno = osGetLastError();
36025 rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno,
36026 "winMapfile1", pFd->zPath);
36029 osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
36035 pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap);
36037 pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap);
36040 osCloseHandle(pFd->hMap);
36041 pFd->hMap = NULL;
36042 pFd->lastErrno = osGetLastError();
36043 rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno,
36044 "winMapfile2", pFd->zPath);
36047 osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
36050 pFd->pMapRegion = pNew;
36051 pFd->mmapSize = nMap;
36052 pFd->mmapSizeActual = nMap;
36056 osGetCurrentProcessId(), pFd));
36075 winFile *pFd = (winFile*)fd; /* The underlying database file */
36083 if( pFd->mmapSizeMax>0 ){
36084 if( pFd->pMapRegion==0 ){
36085 int rc = winMapfile(pFd, -1);
36088 osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
36092 if( pFd->mmapSize >= iOff+nAmt ){
36093 *pp = &((u8 *)pFd->pMapRegion)[iOff];
36094 pFd->nFetchOut++;
36116 winFile *pFd = (winFile*)fd; /* The underlying database file */
36121 assert( (p==0)==(pFd->nFetchOut==0) );
36124 assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] );
36127 osGetCurrentProcessId(), pFd, iOff, p));
36130 pFd->nFetchOut--;
36136 winUnmapfile(pFd);
36139 assert( pFd->nFetchOut>=0 );
41075 #define isOpen(pFd) ((pFd)->pMethods)
50151 sqlite3_file *pFd; /* The WAL file to which we write */
50174 rc = sqlite3OsWrite(p->pFd, pContent, iFirstAmt, iOffset);
50180 rc = sqlite3OsSync(p->pFd, p->syncFlags & SQLITE_SYNC_MASK);
50183 rc = sqlite3OsWrite(p->pFd, pContent, iAmt, iOffset);
50301 w.pFd = pWal->pWalFd;
50345 rc = sqlite3OsSync(w.pFd, sync_flags & SQLITE_SYNC_MASK);
60791 sqlite3_file *pFd; /* File descriptor for database pTo */
60797 pFd = sqlite3PagerFile(sqlite3BtreePager(pTo));
60798 if( pFd->pMethods ){
60800 rc = sqlite3OsFileControl(pFd, SQLITE_FCNTL_OVERWRITE, &nByte);