lkml.org 
[lkml]   [1997]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Big mallocs, mmap sorrows and double buffering.
Date
Matti Aarnio <matti.aarnio@tele.fi> writes:

|>> icp = (char *)mmap( 0, st.st_size,
|>> PROT_READ, MAP_FILE | MAP_PRIVATE, ifd, 0);

|> Ouch! You need: MAP_FILE|MAP_SHARED
|> You don't want a private copy of it!

Since PROT_WRITE is not set this is in effect a shared mapping (and Linux
internally handles it like a shared mapping).

|>> ocp = (char *)mmap( 0, st.st_size,
|>> PROT_WRITE, MAP_FILE | MAP_PRIVATE, ofd, 0);

|> No, you can't mmap() for writing the file.

Sure you can (if you use MAP_SHARED).
--
Andreas Schwab "And now for something
schwab@issan.informatik.uni-dortmund.de completely different"

\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.047 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site