mmap question

Ulrich Drepper drepper at redhat.com
Mon Jul 4 16:52:55 UTC 2005


Hans de Goede wrote:
> open /dev/mem
> mmap the entire lfb
> close /dev/mem
> mmap part of the lfb (64k) at a random address, using the mmap of the
>  entire lfb as source instead of an fd.
> mmap another part of the lfb (64k) at the address the previous part had.

Just like this, it is not possible.  mmap always uses a file descriptor.

The closest technique to what you describe is the remap_file_pages()
function.  No file descriptor needed and you can remap parts of a
previously mmap()ed area to other file offsets, on a per-page basis.
I.e., map for instance 128k initially, then you can map the
128k/pagesize pages of the map each to a different offset of the
underlying "file".

And no, you cannot use /proc/self/mem for any of this.  mmap of
/proc/self/mem is not possible.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/fedora-devel-list/attachments/20050704/54f9b853/attachment.sig>


More information about the fedora-devel-list mailing list