Fix build issue on Debian/kFreeBSD 7.0

There are posix_fadvise(2) but not POSIX_FADV_WILLNEED.
Patch from Ryo ONODERA.
This commit is contained in:
Akira TAGOH 2013-10-21 11:50:55 +09:00
parent 5406919c5e
commit 06b388523d
1 changed files with 2 additions and 1 deletions

View File

@ -28,6 +28,7 @@
#include <dirent.h> #include <dirent.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <assert.h> #include <assert.h>
#if defined(HAVE_MMAP) || defined(__CYGWIN__) #if defined(HAVE_MMAP) || defined(__CYGWIN__)
# include <unistd.h> # include <unistd.h>
@ -572,7 +573,7 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
{ {
#if defined(HAVE_MMAP) || defined(__CYGWIN__) #if defined(HAVE_MMAP) || defined(__CYGWIN__)
cache = mmap (0, fd_stat->st_size, PROT_READ, MAP_SHARED, fd, 0); cache = mmap (0, fd_stat->st_size, PROT_READ, MAP_SHARED, fd, 0);
#ifdef HAVE_POSIX_FADVISE #if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)
posix_fadvise (fd, 0, fd_stat->st_size, POSIX_FADV_WILLNEED); posix_fadvise (fd, 0, fd_stat->st_size, POSIX_FADV_WILLNEED);
#endif #endif
if (cache == MAP_FAILED) if (cache == MAP_FAILED)