Commit a790ccc6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

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

parent 5d00d361
......@@ -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)])
......
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment