On 1/31/11 1:47 AM, Daniel Wagner wrote:
> On Fri, Jan 28, 2011 at 08:13:28PM -0800, Grant Erickson wrote:
>> As far as I can see, the stats mapping is not published or shared outside of
>> connman. If so, there's no reason to map it SHARED versus PRIVATE.
> 
>> From the mmap man pages:
> 
> MAP_SHARED 
> 
>   Share this mapping.  Updates to the mapping are visible to
>            other processes that map this file, and are carried through
>            to the underlying file.  The file may not actually be
>            updated until msync(2) or munmap() is called.
> 
> MAP_PRIVATE
> 
>            Create a private copy-on-write mapping.  Updates to the
>            mapping are not visible to other processes mapping the same
>            file, and are not carried through to the underlying file.
>            It is unspecified whether changes made to the file after
>            the mmap() call are visible in the mapped region.
> 
> The reason for picking MAP_SHARED was to be sure the changes in buffer
> really hits the file. I read that MAP_PRIVATE does not garantee this.
> This is reason I was picking MAP_SHARED together with msync.

Daniel:

Thanks for the clarification on the rationale for choosing MAP_SHARED. I'll
have to do some digging in to determine why MAP_SHARED fails on the
ARM/Linux 2.6.32 kernel.

It might be beneficial to add the above comments to the source file for
future reference.

Best,

Grant


_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to