From 8a7278874b10097a1ea39a35d2c8e85e7d1fedf4 Mon Sep 17 00:00:00 2001 From: Christophe Mutricy Date: Thu, 21 Feb 2008 21:57:16 +0000 Subject: [PATCH] Some OSes don't have posix_fadvise --- configure.ac | 2 +- modules/access/mmap.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7e86b560cb..c314cf3132 100644 --- a/configure.ac +++ b/configure.ac @@ -469,7 +469,7 @@ dnl Check for system libs needed need_libc=false dnl Check for usual libc functions -AC_CHECK_FUNCS([gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat strlcpy strdup strndup strnlen atof lldiv]) +AC_CHECK_FUNCS([gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat strlcpy strdup strndup strnlen atof lldiv posix_fadvise posix_madvise]) AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)]) AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)]) AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)]) diff --git a/modules/access/mmap.c b/modules/access/mmap.c index 3acbc3c644..57ed8bf78f 100644 --- a/modules/access/mmap.c +++ b/modules/access/mmap.c @@ -131,7 +131,9 @@ static int Open (vlc_object_t *p_this) p_sys->fd = fd; p_access->info.i_size = st.st_size; +#ifdef HAVE_POSIX_FADVISE posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL); +#endif return VLC_SUCCESS; @@ -212,7 +214,9 @@ static block_t *Block (access_t *p_access) msleep (INPUT_ERROR_SLEEP); return NULL; } +#ifdef HAVE_POSIX_MADVISE posix_madvise (addr, length, POSIX_MADV_SEQUENTIAL); +#endif block_t *block = block_mmap_Alloc (addr, length); if (block == NULL) -- 2.11.4.GIT