summaryrefslogtreecommitdiffstats
path: root/vpnor/test/write_rw.cpp
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2018-03-27 12:13:25 +1030
committerAndrew Jeffery <andrew@aj.id.au>2018-04-04 17:27:31 +0930
commit506f2f556e2ad09b40980e2e578ca5039850b4ca (patch)
tree17c6f1a6ef637fab13cfccc566dbce28610b8386 /vpnor/test/write_rw.cpp
parent52a8319658c8ac3dcce2fed116d20d6014d7b143 (diff)
downloadphosphor-mboxd-506f2f556e2ad09b40980e2e578ca5039850b4ca.zip
phosphor-mboxd-506f2f556e2ad09b40980e2e578ca5039850b4ca.tar.gz
test: vpnor: Use MAP_SHARED for read-only file memory map
It's not well defined whether a private mapping of a resource that is MAP_SHARED on a separate file descriptor will see the updates done via the shared mapping, though under Linux if the private mapping is not written then we can expect updates from the shared mapping to propagate (copy-on-write). However, we get a concrete guarantee of the desired behaviour (observing the effects of the write) if we use MAP_SHARED. Change-Id: If6a053209a979ee5b96ed09c60fbbd9bdb060a32 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Diffstat (limited to 'vpnor/test/write_rw.cpp')
-rw-r--r--vpnor/test/write_rw.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/vpnor/test/write_rw.cpp b/vpnor/test/write_rw.cpp
index 1ee5c6c..1c4bd38 100644
--- a/vpnor/test/write_rw.cpp
+++ b/vpnor/test/write_rw.cpp
@@ -47,7 +47,7 @@ int main(void)
rc = write_flash(ctx, 0x1000, src, sizeof(src));
assert(rc == 0);
fd = open((root.rw() / "TEST1").c_str(), O_RDONLY);
- map = mmap(NULL, sizeof(src), PROT_READ, MAP_PRIVATE, fd, 0);
+ map = mmap(NULL, sizeof(src), PROT_READ, MAP_SHARED, fd, 0);
assert(map != MAP_FAILED);
rc = memcmp(src, map, sizeof(src));
assert(rc == 0);
OpenPOWER on IntegriCloud