From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: mmap/munmap semantics References: From: James Antill Reply-To: Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=US-ASCII Date: 22 Feb 2000 13:36:21 -0500 In-Reply-To: Richard Guenther's message of "Tue, 22 Feb 2000 18:46:02 +0100 (MET)" Message-ID: Sender: owner-linux-mm@kvack.org Return-Path: To: Richard Guenther Cc: Linux Kernel List , glame-devel@lists.sourceforge.net, Linux-MM List-ID: > Hi! > > With the ongoing development of GLAME there arise the following > problems with the backing-store management, which is a mmaped > file and does "userspace virtual memory management": > - I cannot see a way to mmap a part of the file but set the > contents initially to zero, i.e. I want to setup an initially > dirty zero-mapping which is assigned to a part of the file. > Currently I'm just mmaping the part and do the zeroing by > reading from /dev/zero (which does as I understand from the > kernel code just create this zero mappings) - is there a more > portable way to achieve this? I think you want to truncate/lseek after open but before you mmap, if I'm reading what you want to do properly. This is portable (at least it works on Linux/FreeBSD/Solaris). > - I need to "drop" a mapping sometimes without writing the contents > back to disk - I cannot see a way to do this with linux currently. > Ideally a hole could be created in the mmapped file on drop time - > is this possible at all with the VFS/ext2 at the moment (creating > a hole in a file by dropping parts of it)? The mapping can be synchronized with the file before you munmap() so I'm not sure what you want mrevert() ? -- I'm positive you're going to have to do this in user space (Ie. copy the file and then rename() or don't rename() at munmap() time -- or do a private mapping and write() to the file at munmap()). -- James Antill -- james@and.org I am always an optimist, but frankly there is no hope. -Hosni Mubarek -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux.eu.org/Linux-MM/