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

Use fstatvfs where usable (BSD) - fixes #3762

(cherry picked from commit 62a73f7d2d352c90014ae6b142fecceb173f4443)

Conflicts:

	configure.ac
parent affcbabe
...@@ -549,14 +549,14 @@ dnl Check for system libs needed ...@@ -549,14 +549,14 @@ dnl Check for system libs needed
need_libc=false need_libc=false
dnl Check for usual libc functions dnl Check for usual libc functions
AC_CHECK_FUNCS([ctime_r daemon fcntl fdopendir fork getenv getpwuid_r gettimeofday isatty lstat memalign openat posix_fadvise posix_madvise posix_memalign setenv setlocale stricmp strnicmp tdestroy uselocale]) AC_CHECK_FUNCS([ctime_r daemon fcntl fdopendir fstatvfs fork getenv getpwuid_r gettimeofday isatty lstat memalign openat posix_fadvise posix_madvise posix_memalign setenv setlocale stricmp strnicmp tdestroy uselocale])
AC_REPLACE_FUNCS([asprintf atof atoll getcwd getdelim getpid gmtime_r lldiv localtime_r nrand48 rewind strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab vasprintf]) AC_REPLACE_FUNCS([asprintf atof atoll getcwd getdelim getpid gmtime_r lldiv localtime_r nrand48 rewind strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab vasprintf])
AC_CHECK_FUNCS(fdatasync,, AC_CHECK_FUNCS(fdatasync,,
[AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.]) [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
]) ])
dnl Check for non-standard system calls dnl Check for non-standard system calls
AC_CHECK_FUNCS([accept4 dup3 eventfd fstatfs vmsplice]) AC_CHECK_FUNCS([accept4 dup3 eventfd vmsplice])
AH_BOTTOM([#include <vlc_fixups.h>]) AH_BOTTOM([#include <vlc_fixups.h>])
......
...@@ -39,21 +39,20 @@ ...@@ -39,21 +39,20 @@
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
# include <sys/stat.h> # include <sys/stat.h>
#endif #endif
#if defined(HAVE_FSTATFS) && defined(__SunOS)
# undef HAVE_FSTATFS
#endif
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
# include <fcntl.h> # include <fcntl.h>
#endif #endif
#if defined (__linux__) #ifdef HAVE_FSTATVFS
# include <sys/vfs.h> # include <sys/statvfs.h>
# if defined (HAVE_SYS_MOUNT_H)
# include <sys/param.h>
# include <sys/mount.h>
# endif
#endif
#ifdef HAVE_LINUX_MAGIC_H #ifdef HAVE_LINUX_MAGIC_H
# include <sys/vfs.h>
# include <linux/magic.h> # include <linux/magic.h>
#endif #endif
#elif defined (HAVE_SYS_MOUNT_H)
# include <sys/param.h>
# include <sys/mount.h>
#endif
#if defined( WIN32 ) #if defined( WIN32 )
# include <io.h> # include <io.h>
...@@ -91,17 +90,20 @@ struct access_sys_t ...@@ -91,17 +90,20 @@ struct access_sys_t
#ifndef WIN32 #ifndef WIN32
static bool IsRemote (int fd) static bool IsRemote (int fd)
{ {
#ifdef HAVE_FSTATFS #if defined (HAVE_FSTATVFS) && defined (MNT_LOCAL)
struct statvfs stf;
if (fstatvfs (fd, &stf))
return false;
/* fstatvfs() is in POSIX, but MNT_LOCAL is not */
return !(s.f_flag & MNT_LOCAL);
#elif defined (HAVE_LINUX_MAGIC_H)
struct statfs stf; struct statfs stf;
if (fstatfs (fd, &stf)) if (fstatfs (fd, &stf))
return false; return false;
#if defined(MNT_LOCAL)
return !(stf.f_flags & MNT_LOCAL);
#else
# ifdef HAVE_LINUX_MAGIC_H
switch (stf.f_type) switch (stf.f_type)
{ {
case AFS_SUPER_MAGIC: case AFS_SUPER_MAGIC:
...@@ -113,9 +115,8 @@ static bool IsRemote (int fd) ...@@ -113,9 +115,8 @@ static bool IsRemote (int fd)
return true; return true;
} }
return false; return false;
# endif
#endif #else
#else /* !HAVE_FSTATFS */
(void)fd; (void)fd;
return false; return false;
......
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