![]() | |||||||||||||
Messages in this thread |
Matti Aarnio once wrote: > > It depends -- if the file page is pre-allocated, you can > write to it via MAP_SHARED, but you can't extend a file > just by overmapping a memory region, and then storeing > into those non-backed pages. That is where you will > always need write(). > > I recall the `ofd' was opened with O_TRUNC flag, which means > it had zero size... > > In many systems attempt to mmap() [PROT_WRITE, MAP_SHARED] on > a file with holes in it (or beyond its end) produces an error. > Here we are treading on extremely varying area of system > implementations. > Well, at least under Linux and SunOS mmap()ing a file with a hole looks Ok. I usually ftruncate() a file to 2G, do all the mmap()ed I/O I need and then ftruncate() it back to an original size. Does anyone know a good reason not to support an mmap beyond the end of file? -- _. _ . (_ ,_ _ , . / ` _ _L | Email: Oleg Kibirev <snowcat@netgate.net> ._)| U(_)\/\/ \_,(_L/L | Visit http://math.math.CSUFresno.EDU/~oleg/math.html ------------------------' to get my programs + PGP public key | ||||||||||||
| Last update: 2005-03-22 13:38 [W:0.235 / U:1.290 seconds] ©2003-2008 Jasper Spaans | |||||||||||||