MMAP and pointer
Hello,
I use mmap at first time with. source = mmap (NULL, fst1.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, file, 0)) == (void *) -1) Return pointer c0xb7fb1000. after this I use: source2 = mmap (source, fst1.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, file, 0)) == (void *) -1) Return pointer 0xb7fb0000. Why source2 != source? :scratch: I can not understand it. Thanks in advance. |
Read the manpage of mmap. On the first page of the manpage:
Quote:
|
To have both at the same address, you can use the flag MAP_FIXED, but if that fails, nothing will be done. (It's in the manpage too)
|
Well is true.
The problem is that I can not write to disk a stream I do not know.
char *hello[]={"Hello I think in this kkkkkkkkkkkkkkkkkkkkkkkkkkkkklllllllllllllllllllllllfin"}; Pointer hello is 0xbfc7efac. pointer to disk 0xb7f81000 of mmap return. memcpy (0xbfc7efac to 0xb7f81000 30 bytes). msync(pointer to disk). Any error of this functions. But in file I can not view hello 30 bytes. I do not understand it. |
All times are GMT -5. The time now is 01:39 AM. |