At 19:10 -0400 2002.07.09, Louis Demers wrote: At 12:27 -0400 2002.07.09, Jim Magee wrote: On Tuesday, July 9, 2002, at 12:32 AM, Louis Demers wrote: trying to port inn news server 2.3.3 to osx and the standard distribution seems to have problems with a mmap call. A static data is mmap to a file and then porperly written (I dumped all 130180 bytes to a file and it's ok) but when unmapped, the file reverts to all zeros. I checked and the file descriptor is opened with O_RDWR, the mmap is done with PROT_WRITE|PROT_READ. Did you msync() your changes or just munmap()? I tried msync() at various points before and after the close (GROUPfd) but always before the munmap. well, when I tried msync, I passed 0 as the length, interpreting the documentation as meaning that it would sync everything needed. Wrong. I now pass explicitly the length and it seems to write the modification to disk correctly.
From the number of systems on which this code worked,
I wonder if the OSX behaviour should not be revised. shouldn't munmap sync before unmapping. It is as if we were required to call fflush before fclose to make sure our writes are comitted to the file ! Cheers. -- Louis Demers ing. LouisDemers@mac.com _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.