Monday, November 06, 2006

[TECH]Crippled mmap

I was trying to use a anonymous memory mapping to use in the first version of the Tile database memory manager which I was writing,

mmap(void *start_address,size_t length,int prot,int flags,int fd,off_t offset)

. I had prot = MAP_ANONYMOUS , (I thought its equivalent to MAP_ANON | MAP_PRIVATE , the man page says MAP_ANON , is depreciated). Well any way I got it fixed by MAP_ANONYMOUS | MAP_PRIVATE.

Last time I had problem with this syscall is when I need to mmap to actual address's , i.e the start_address argument is not NULL, once again WHEN YOU DO A MMAP FOR A STATIC ADDRESS YOU NEED TO HAVE OFFSET OF THE FILE ALIGNED TO THE PAGE BOUNDARY.

No comments: