Sander Striker wrote:
Hi,
Using mmap to gain some performance I stumbled across the following.
$ touch empty_file
...
rv = apr_file_open(&f, "empty_file", ...) rv = apr_file_info_get(&finfo, APR_FINFO_SIZE, f); rv = apr_mmap_create(&mm, f, 0, finfo.size, APR_MMAP_READ, ...);
[so far rv == APR_SUCCESS the whole time]
rv = apr_mmap_delete(mm);
[failure, rv == 22 (EINVAL?)]
My guess is that munmap doesn't like the 0 passed in for size. It strikes me as odd though that mmap doesn't seem to care about that.
Is there a known issue with mmapping 0 sized files?
FYI, I'm on Linux 2.4.20, glibc 2.3.1.
does strace show that it is kernel behavior in question rather than something questionable that APR may be doing?