[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: mmap question



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 ❖

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]