Here is a part of code in [unixWrite]. (os_unix.h)
Is not it written by mmap ?


#if SQLITE_MAX_MMAP_SIZE0
 /* Deal with as much of this write request as possible by transfering
 ** data from the memory mapping using memcpy(). */
 if( offsetpFile-mmapSize ){
  if( offset+amt = pFile-mmapSize ){
   int size = -1;
   struct stat buf;       /* Used to hold return values of fstat() */
   if( !osFstat(pFile-h, buf) ){
    size = (int)buf.st_size;
   }
   memcpy(((u8 *)(pFile-pMapRegion))[offset], pBuf, amt);
   return SQLITE_OK;
  }else{
   int nCopy = (int)(pFile-mmapSize - offset);
   memcpy(((u8 *)(pFile-pMapRegion))[offset], pBuf, nCopy);
   pBuf = ((u8 *)pBuf)[nCopy];
   amt -= nCopy;
   offset += nCopy;
  }
 }
#endif




原始邮件
发件人:Richard hipp...@sqlite.org
收件人:SQLite mailing listsqlite-us...@mailinglists.sqlite.org
发送时间:2016年11月3日(周四) 17:49
主题:Re: [sqlite] Is msync necessary for SQLite?


On 11/3/16, sanhua.zh sanhua...@foxmail.com wrote:  I run in iOS. The mmap is 
enable in recent version.  So, once a mmap enable, data may lost after os crash 
unless msync. But I  can’t find anywhere in the source of SQLite call the 
msync. Is it a bug? No. Mmap() is only used for reading, not writing. All 
changes are implemented by calling write() and fsync(). -- D. Richard Hipp 
d...@sqlite.org _______________________________________________ sqlite-users 
mailing list sqlite-users@mailinglists.sqlite.org 
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to