Corinna Vinschen wrote: > mmap always allocates in 64K chunks.
That doesn't seem to be true in practice. In the test below I mmap a 1080K file (this is a multiple of 4K but not a multiple of 64K). The first byte after the end of the file isn't readable. $ cat mmaptest.c #include <fcntl.h> #include <stdio.h> #include <sys/mman.h> #include <sys/stat.h> int main(int argc, char *argv[]) { int fd; struct stat st; void *p; if (argc != 2) return 1; if ((fd = open(argv[1], O_RDONLY, 0)) < 0) return 1; if (fstat(fd, &st) != 0) return 1; if ((p = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED) return 1; printf("last byte 0x%02X\n", ((unsigned char *)p)[st.st_size - 1]); fflush(stdout); printf("next byte 0x%02X\n", ((unsigned char *)p)[st.st_size]); return 0; } $ gcc -o mmaptest mmaptest.c $ dd bs=1080K count=1 if=/dev/random of=foo 1+0 records in 1+0 records out 1105920 bytes (1.1 MB) copied, 0.077 s, 14.4 MB/s $ ./mmaptest foo last byte 0x5F 9 [main] mmaptest 3040 _cygtls::handle_exceptions: Error while dumping sta te (probably corrupted stack) Segmentation fault (core dumped) This is a recent cygwin installation on XP Pro SP2. Thanks, Jay. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/