[vlc-devel] commit: Check for vmsplice() since Middle Ages libc didn't have it ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue Dec 16 17:07:57 CET 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Tue Dec 16 18:05:47 2008 +0200| [a790ccc6542769745a32de4d3223fa1b3a3dc961] | committer: Rémi Denis-Courmont 

Check for vmsplice() since Middle Ages libc didn't have it

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a790ccc6542769745a32de4d3223fa1b3a3dc961
---

 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 0eec721..ac56232 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 3228616..09f397d 100644
--- a/modules/stream_filter/decomp.c
+++ b/modules/stream_filter/decomp.c
@@ -31,13 +31,13 @@
 #include <spawn.h>
 #include <sys/wait.h>
 #include <sys/ioctl.h>
-#ifdef __linux__
+#if defined (__linux__) && defined (HAVE_VMSPLICE)
 # include <sys/uio.h>
 # include <sys/mman.h>
+#else
+# undef HAVE_VMSPLICE
 #endif
 
-#include <assert.h>
-
 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
     }




More information about the vlc-devel mailing list