Re: Having problem with mmap system call!!!

From: Alan Cox
Date: Thu Sep 16 2004 - 16:08:03 EST


On Iau, 2004-09-16 at 19:13, Richard B. Johnson wrote:

> for (i = 0; i < v->page_count; i++) {
> unsigned long page = virt_to_phys((void *)v->desc[i]);
> if (remap_page_range(start, page, PAGE_SIZE, PAGE_READONLY)) {
> err = -EAGAIN;
> goto out;
> }
> start += PAGE_SIZE;

Actually thats a nice example of how easy it is to implement mmap
properly.


> you usually say... Anyway are you aware that ...
>
> unsigned long size = vma->vm_end - vma->vm_start;
>
> ... ends up being 32 bytes longer than the length the user-mode
> code put into mmap()?

Its page aligned, that is what mmap() says happens.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/