mmap of readonly file (was Re: sendfile(2) idea)

Stephen Williams (steve@icarus.icarus.com)
Sun, 12 Jul 1998 12:22:55 -0700


stefan@sime.com said:
> open("./page", O_RDONLY) = 3
> mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0x400ad000

> I don't have a POSIX copy here; but PROT_WRITE on a O_RDONLY fd should
> IMHO fail...

Try again with MAP_SHARED instead of MAP_PRIVATE. Also, try writing to your
private mapped region and seeing what (if anything) happens to the file.
Do the same test with MAP_SHARED.

-- 
Steve Williams                "The woods are lovely, dark and deep.
steve@icarus.com              But I have promises to keep,
steve@picturel.com            and lines to code before I sleep,
http://www.picturel.com       And lines to code before I sleep."

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html