Re: how mmap() works?

From: J . A . Magallon (jamagallon@able.es)
Date: Thu Mar 29 2001 - 17:38:01 EST


On 03.30 Jerry Hong wrote:
> Hi,
> mmap() creates a mmaped memory associated with a
> physical file. If a process updates the mmaped memory,
> Linux will updates the file "automatically". If this
> is the case, why do we need msync()? If this is not

Where did you heard that ?

man mmap(2):
..
       MAP_SHARED Share this mapping with all other processes
                  that map this object. Storing to the region is
                  equivalent to writing to the file. The file
                  may not actually be updated until msync(2) or
                  munmap(2) are called.
..
man msync(2):
..
DESCRIPTION
       msync flushes changes made to the in-core copy of a file
       that was mapped into memory using mmap(2) back to disk.
       Without use of this call there is no guarantee that
       changes are written back before munmap(2) is called. To
.

-- 
J.A. Magallon                                          #  Let the source
mailto:jamagallon@able.es                              #  be with you, Luke... 

Linux werewolf 2.4.2-ac28 #1 SMP Thu Mar 29 16:41:17 CEST 2001 i686

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



This archive was generated by hypermail 2b29 : Sat Mar 31 2001 - 21:00:22 EST