I have some code resembling: FILE * f = fopen (filename, "rb"); mmap (NULL, st.st_size, PROT_READ, MAP_PRIVATE, fileno (f), 0);
I've found that reads are not brought into disk cache. Successive reads on the same file once again read from disk. If I cat the file to /dev/null, then the mmap(2) does indeed read the data from cache. What's going on here? Also, the man page states that the mapped region may be longer than the specified size. Does this have any implications for the size which is passed to munmap(2)? If I pass the same size to munmap(2), then will there still be leftover, or will the entire region be unmapped? And, should I be passing MAP_PRIVATE or MAP_SHARED to read-only mmaps? Does it make any difference at all? Running 5.1-RELEASE. _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"