From a790ccc6542769745a32de4d3223fa1b3a3dc961 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Tue, 16 Dec 2008 18:05:47 +0200 Subject: [PATCH] Check for vmsplice() since Middle Ages libc didn't have it --- configure.ac | 2 +- modules/stream_filter/decomp.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 0eec721265..ac56232359 100644 --- a/configure.ac +++ b/configure.ac @@ -492,7 +492,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_r 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 uselocale]) +AC_CHECK_FUNCS([gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid_r 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 uselocale vmsplice]) 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/stream_filter/decomp.c b/modules/stream_filter/decomp.c index 32286165c3..09f397dd38 100644 --- a/modules/stream_filter/decomp.c +++ b/modules/stream_filter/decomp.c @@ -31,13 +31,13 @@ #include #include #include -#ifdef __linux__ +#if defined (__linux__) && defined (HAVE_VMSPLICE) # include # include +#else +# undef HAVE_VMSPLICE #endif -#include - static int OpenGzip (vlc_object_t *); static int OpenBzip2 (vlc_object_t *); static void Close (vlc_object_t *); @@ -82,7 +82,7 @@ static void *Thread (void *data) { stream_t *stream = data; stream_sys_t *p_sys = stream->p_sys; -#ifdef __linux__ +#ifdef HAVE_VMSPLICE ssize_t page_mask = sysconf (_SC_PAGE_SIZE) - 1; #endif int fd = p_sys->write_fd; @@ -92,7 +92,7 @@ static void *Thread (void *data) { ssize_t len; int canc = vlc_savecancel (); -#ifdef __linux__ +#ifdef HAVE_VMSPLICE unsigned char *buf = mmap (NULL, bufsize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); vlc_cleanup_push (cleanup_mmap, buf); @@ -106,7 +106,7 @@ static void *Thread (void *data) for (ssize_t i = 0, j; i < len; i += j) { -#ifdef __linux__ +#ifdef HAVE_VMSPLICE if ((len - i) <= page_mask) /* incomplete last page */ j = write (fd, buf + i, len - i); else @@ -126,7 +126,7 @@ static void *Thread (void *data) break; } } -#ifdef __linux__ +#ifdef HAVE_VMSPLICE vlc_cleanup_run (); /* munmap (buf, bufsize) */ #endif } -- 2.39.5