Hello!

On Fri, 23 Jun 2006, Konstantin Belousov wrote:
    if ((diskp=mmap(NULL, 512,
        PROT_READ | PROT_WRITE, 0, fd, 0)) == MAP_FAILED)
            err(EX_IOERR, "Can't mmap() file");

shows actual first byte of my file. But modification doesn't get written
back to the disk, file contents are unchanged after execution of my code.
I'm sure I'm overlooking something very basic and stupid, but can't find
what exactly.
You forgot MAP_SHARED.

 Thank you! Yes, that's it. I would say that it's description

     MAP_SHARED        Modifications are shared.

is rather terse and doesn't explicitly says that w/o it data will not be
stored back to the mmapped object. One can only deduce this behaviour,
and deduction sometimes fails at the end of working day ;)


Sincerely, Dmitry
--
Atlantis ISP, System Administrator
e-mail:  [EMAIL PROTECTED]
nic-hdl: LYNX-RIPE
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to