:hi all,
:
:i have a question regarding mmap and file write. a file is mmap'ed and
:data is written into the mapped region. now the same region is written.
:(as shown below)
:
:buf = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
:.
:. /* some data put in buf */
:.
:
:write(fd, buf, len);
:
:
:now does this lead to unnecessary copies?? more specifically what
:happens if two virtual addresses point to the same physical address and
:data is copied from one to the other.
:
:thanx in advance
:
:joy
You can copy data from one part of a file to another using
this method, but only if the two areas do not overlap. If
the areas overlap, the result will be possible corruption of the
file.
-Matt
Matthew Dillon
<[EMAIL PROTECTED]>
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message