Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Change the xShmSize() implementation in os_unix.c so that it will only increase and never decrease the size of a shared-memory segment. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | wal-refactor |
Files: | files | file ages | folders |
SHA1: |
149d2ae4a6fe2f86822f286d2a7092c5 |
User & Date: | drh 2010-05-13 08:33:36.000 |
Original Comment: | Change the xShmSize() implementation in os_unix.c so that it will only increase and never decrease the size of a shared-memory segment. |
Context
2010-05-13
| ||
08:53 | The refactored of VFS SHM primitives are now working so merge the wal-refactor branch back into the trunk. (check-in: bce21c1838 user: drh tags: trunk) | |
08:33 | Change the xShmSize() implementation in os_unix.c so that it will only increase and never decrease the size of a shared-memory segment. (Closed-Leaf check-in: 149d2ae4a6 user: drh tags: wal-refactor) | |
07:08 | Fix for a segfault that can follow a malloc failure. (check-in: 3cab902245 user: dan tags: wal-refactor) | |
Changes
Changes to src/os_unix.c.
︙ | ︙ | |||
3953 3954 3955 3956 3957 3958 3959 | ){ unixFile *pDbFd = (unixFile*)fd; unixShm *p = pDbFd->pShm; unixShmFile *pFile = p->pFile; int rc = SQLITE_OK; struct stat sStat; | > > > > > > > > > > > > > > | < < < < | < | 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 | ){ unixFile *pDbFd = (unixFile*)fd; unixShm *p = pDbFd->pShm; unixShmFile *pFile = p->pFile; int rc = SQLITE_OK; struct stat sStat; /* On a query, this loop runs once. When reqSize>=0, the loop potentially ** runs twice, except if the actual size is already greater than or equal ** to the requested size, reqSize is set to -1 on the first iteration and ** the loop only runs once. */ while( 1 ){ if( fstat(pFile->h, &sStat)==0 ){ *pNewSize = (int)sStat.st_size; if( reqSize>=0 && reqSize<=(int)sStat.st_size ) break; }else{ *pNewSize = 0; rc = SQLITE_IOERR; break; } if( reqSize<0 ) break; reqSize = (reqSize + SQLITE_UNIX_SHM_INCR - 1)/SQLITE_UNIX_SHM_INCR; reqSize *= SQLITE_UNIX_SHM_INCR; rc = ftruncate(pFile->h, reqSize); reqSize = -1; } return rc; } /* ** Map the shared storage into memory. The minimum size of the |
︙ | ︙ |