I have a memory-mapped file and I'm writing changes to the memory region returned, but they don't appear to take.
Code:
	int des = open("processed.dat", O_RDWR | O_CREAT | O_NOATIME, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
	assert(des != -1);
	void *buf = mmap(NULL, SIZEOFTHESUCKA, PROT_READ | PROT_WRITE, MAP_PRIVATE, des, 0);
	assert(buf != MAP_FAILED);

...     //some code that writes to buf

const unsigned char *p = (const unsigned char *)buf;
for (int i = 0; i < SIZEOFTHESUCKA; i++)
	fprintf(stderr, "%02X ", (int)p[i]);
fprintf(stderr, "\n");
	assert(munmap(buf, SIZEOFTHESUCKA) == 0);
	close(des);
The stderr shows the values:
Code:
6D 00 00 04 00 16 33 12
But when I call:
Code:
hexdump processed.dat
I only get:
Code:
0000000 0000 0000 0000 0000
0000008
I should also point out that before the file is opened it is already SIZEOFTHESUCKA bytes long, and is zeroed.
NDEBUG is not defined, so munmap() does get called.