aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2013-03-25 19:05:07 +0000
committerdan <dan@noemail.net>2013-03-25 19:05:07 +0000
commit893c0ffc290bb59bcd8f505bec45087211579525 (patch)
tree88f92096a046fabec8b48224ae214183d6c340bf /src/os_unix.c
parenta64d5a15b7d85ee49c5632ee37f6c0bd3242d258 (diff)
downloadsqlite-893c0ffc290bb59bcd8f505bec45087211579525.tar.gz
sqlite-893c0ffc290bb59bcd8f505bec45087211579525.zip
Add a test that simulates an error in mmap().
FossilOrigin-Name: 6ec7367d8e98425f00eeb8215ca8964313c1d0b7
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 00c0088f8..8175bd5c9 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -444,6 +444,9 @@ static struct unix_syscall {
{ "fchown", (sqlite3_syscall_ptr)posixFchown, 0 },
#define osFchown ((int(*)(int,uid_t,gid_t))aSyscall[20].pCurrent)
+ { "mmap", (sqlite3_syscall_ptr)mmap, 0 },
+#define osMmap ((void*(*)(void*,size_t,int,int,int,off_t))aSyscall[21].pCurrent)
+
}; /* End of the overrideable system calls */
/*
@@ -4547,7 +4550,7 @@ static int unixMapfile(unixFile *pFd, i64 nByte){
void *pNew;
int flags = PROT_READ;
if( (pFd->ctrlFlags & UNIXFILE_RDONLY)==0 ) flags |= PROT_WRITE;
- pNew = mmap(0, nMap, flags, MAP_SHARED, pFd->h, 0);
+ pNew = osMmap(0, nMap, flags, MAP_SHARED, pFd->h, 0);
if( pNew==MAP_FAILED ){
return SQLITE_IOERR_MMAP;
}
@@ -7186,7 +7189,7 @@ int sqlite3_os_init(void){
/* Double-check that the aSyscall[] array has been constructed
** correctly. See ticket [bb3a86e890c8e96ab] */
- assert( ArraySize(aSyscall)==21 );
+ assert( ArraySize(aSyscall)==22 );
/* Register all VFSes defined in the aVfs[] array */
for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){