- darwin 7 doesn't like madvise

- use posix_madvise instead of madvise


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@959 152afb58-edef-0310-8abb-c4023f1b3aa9
This commit is contained in:
Jan Kneschke 2006-01-31 10:56:01 +00:00
parent de3bdbf1a2
commit 869b6d4585
1 changed files with 6 additions and 4 deletions

View File

@ -257,10 +257,12 @@ int network_write_chunkqueue_writev(server *srv, connection *con, int fd, chunkq
#else
#ifdef HAVE_MADVISE
/* don't advise files < 64Kb */
if (c->file.mmap.length > (64 KByte) &&
0 != madvise(c->file.mmap.start, c->file.mmap.length, MADV_WILLNEED)) {
log_error_write(srv, __FILE__, __LINE__, "ssbd", "madvise failed:",
strerror(errno), c->file.name, c->file.fd);
if (c->file.mmap.length > (64 KByte)) {
/* darwin 7 is returning EINVAL all the time and I don't know how to
* detect this at runtime.i
*
* ignore the return value for now */
posix_madvise(c->file.mmap.start, c->file.mmap.length, POSIX_MADV_WILLNEED);
}
#endif
#endif