[Fontconfig] fontconfig: Branch 'master'

Akira TAGOH tagoh at kemper.freedesktop.org
Mon Apr 16 20:21:42 PDT 2012


 configure.in  |    2 +-
 src/fccache.c |    3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 9e62fcedfe774a13843cc0982bc3e535369b99eb
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Apr 16 11:28:36 2012 -0700

    Use posix_fadvise to speed startup
    
    Given that fontconfig will scan all of the cache file data during the
    first font search, ask the kernel to start reading the pages right away.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.in b/configure.in
index 1af2367..9c9de30 100644
--- a/configure.in
+++ b/configure.in
@@ -133,7 +133,7 @@ AC_TYPE_PID_T
 # Checks for library functions.
 AC_FUNC_VPRINTF
 AC_FUNC_MMAP
-AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r rand_r regcomp regerror regexec regfree])
+AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r rand_r regcomp regerror regexec regfree posix_fadvise])
 
 #
 # regex
diff --git a/src/fccache.c b/src/fccache.c
index db7561f..343ece9 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -609,6 +609,9 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
     {
 #if defined(HAVE_MMAP) || defined(__CYGWIN__)
 	cache = mmap (0, fd_stat->st_size, PROT_READ, MAP_SHARED, fd, 0);
+#ifdef HAVE_POSIX_FADVISE
+	posix_fadvise (fd, 0, fd_stat->st_size, POSIX_FADV_WILLNEED);
+#endif
 	if (cache == MAP_FAILED)
 	    cache = NULL;
 #elif defined(_WIN32)


More information about the Fontconfig mailing list