Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jun 2000 12:49:17 -0700 (PDT)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Joy Ganguly <joy@niksun.com>
Cc:        freebsd-hackers <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: mmap and file writes...???
Message-ID:  <200006161949.MAA60866@apollo.backplane.com>
References:   <394A3727.1FEC441E@falcon.niksun.com>

next in thread | previous in thread | raw e-mail | index | archive | help
: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 
					<dillon@backplane.com>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200006161949.MAA60866>