v4l2object: Don't use mmap64 if off_t is 64-bit

The difference between mmap and mmap64 is the type of 'offset' argument.
mmap64 always uses a 64-bit interger as offset, while mmap uses off_t,
whose size can vary on different operating systems or architectures.

However, not all operating systems support mmap64. Fortunately, although
FreeBSD only has mmap, its off_t is always 64-bit regardless of
architectures, so we can simply use mmap when sizeof(off_t) == 8.

https://bugzilla.gnome.org/show_bug.cgi?id=791779
This commit is contained in:
Ting-Wei Lan 2017-12-19 17:37:58 +08:00 committed by Nicolas Dufresne
parent 24f01944ee
commit 4026211154
3 changed files with 6 additions and 1 deletions

View file

@ -197,7 +197,7 @@ fi
dnl Check for mmap (needed by electricfence plugin) dnl Check for mmap (needed by electricfence plugin)
AC_FUNC_MMAP AC_FUNC_MMAP
AC_CHECK_FUNCS([mmap64]) AC_CHECK_SIZEOF([off_t])
AM_CONDITIONAL(GST_HAVE_MMAP, test "x$ac_cv_func_mmap_fixed_mapped" = "xyes") AM_CONDITIONAL(GST_HAVE_MMAP, test "x$ac_cv_func_mmap_fixed_mapped" = "xyes")
dnl Check for mmap (needed by electricfence plugin) dnl Check for mmap (needed by electricfence plugin)

View file

@ -126,6 +126,7 @@ cdata.set('SIZEOF_INT', cc.sizeof('int'))
cdata.set('SIZEOF_LONG', cc.sizeof('long')) cdata.set('SIZEOF_LONG', cc.sizeof('long'))
cdata.set('SIZEOF_SHORT', cc.sizeof('short')) cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
cdata.set('SIZEOF_VOIDP', cc.sizeof('void*')) cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
cdata.set('SIZEOF_OFF_T', cc.sizeof('off_t'))
# Here be fixmes. # Here be fixmes.
# FIXME: check if this is correct # FIXME: check if this is correct

View file

@ -55,6 +55,10 @@ GST_DEBUG_CATEGORY_EXTERN (v4l2_debug);
#define ENCODED_BUFFER_SIZE (2 * 1024 * 1024) #define ENCODED_BUFFER_SIZE (2 * 1024 * 1024)
#if SIZEOF_OFF_T == 8
#define mmap64 mmap
#endif
enum enum
{ {
PROP_0, PROP_0,