Skip to content

Commit 1fc0cc1

Browse files
committed
add comment on MAP_SHARED
1 parent 4ea577a commit 1fc0cc1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mmap/reverse.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ main(void)
2828
err(1, "open %s", FNAME);
2929

3030
size = lseek(fd, 0, SEEK_END);
31+
/*
32+
* MAP_SHARED has to be used in order to sync the data to the backing
33+
* store (as opposed to the MAP_PRIVATE).
34+
*/
3135
p1 = addr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
3236

3337
p2 = p1 + size - 1;

0 commit comments

Comments
 (0)