fread() should handle this, no?
True. But I guess my main issue is still that the behaviour changes
radically based on a hidden configure check (ie. whether mmap is there
or not) and that ensuring a block-by-block read in user space is
inefficient for huge files.
good point... hrrmmm....
it seems like this is an option that should be available (somehow), yet I don't really like adding another option to the function, as it requires too much "smarts" on the behalf of the user (at what point does mmap() slow things down instead of speed them up, what is mmap(), etc.)
Perhaps automatic detection could be option? if (filesize > X) blockread else mmap? It seems like the most intuitive way to implement it...
I also wrestled with a configure option use_mmap (which might be good in general), however, that really doesn't solve the problem at hand.
-Sterling