Date: Fri, 23 Jun 2006 20:05:01 +0300 (EEST) From: Dmitry Pryanishnikov <dmitry@atlantis.dp.ua> To: Konstantin Belousov <konstantin.belousov@zoral.com.ua> Cc: freebsd-hackers@freebsd.org Subject: Re: Simple question about mmap() system call Message-ID: <20060623195551.A43353@atlantis.atlantis.dp.ua> In-Reply-To: <20060623150227.GK5115@deviant.kiev.zoral.com.ua> References: <20060623173723.H39481@atlantis.atlantis.dp.ua> <20060623150227.GK5115@deviant.kiev.zoral.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
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: dmitry@atlantis.dp.ua nic-hdl: LYNX-RIPE
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060623195551.A43353>