Date: Tue, 29 Mar 2005 15:41:15 -0800 (PST) From: Richard Sharpe <rsharpe@richardsharpe.com> To: freebsd-hackers@freebsd.org Subject: Possible problems with mmap/munmap on FreeBSD ... Message-ID: <Pine.LNX.4.58.0503291533320.2471@durable>
next in thread | raw e-mail | index | archive | help
Hi, I am having some problems with the tdb package on FreeBSD 4.6.2 and 4.10. One of the things the above package does is: mmap the tdb file to a region of memory store stuff in the region (memmov etc). when it needs to extend the size of the region { munmap the region write data at the end of the file mmap the region again with a larger size } What I am seeing is that after the munmap the data written to the region is gone. However, if I insert an msync before the munmap, everything is nicely coherent. This seems odd (in the sense that it works without the msync under Linux). The region is mmapped with: mmap(NULL, tdb->map_size, PROT_READ|(tdb->read_only? 0:PROT_WRITE), MAP_SHARED|MAP_FILE, tdb->fd, 0); What I notice is that all the calls to mmap return the same address. A careful reading of the man pages for mmap and munmap does not suggest that I am doing anything wrong. Is it possible that FreeBSD is deferring flushing the dirty data, and then forgets to do it when the same starting address is used etc? Regards ----- Richard Sharpe, rsharpe[at]richardsharpe.com, rsharpe[at]samba.org, sharpe[at]ethereal.com, http://www.richardsharpe.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.58.0503291533320.2471>