- 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
svn/tags/lighttpd-1.4.11
Jan Kneschke 17 years ago
parent de3bdbf1a2
commit 869b6d4585
  1. 10
      src/network_writev.c

@ -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

Loading…
Cancel
Save