--- a/lib/libv4lconvert/libv4lsyscall-priv.h +++ b/lib/libv4lconvert/libv4lsyscall-priv.h @@ -35,18 +35,23 @@ which is broken on some systems and doesn't include them itself :( */ #ifdef linux +#define __NEED_off_t #include #include #include #include /* On 32 bits archs we always use mmap2, on 64 bits archs there is no mmap2 */ #ifdef __NR_mmap2 +#undef SYS_mmap2 #define SYS_mmap2 __NR_mmap2 #define MMAP2_PAGE_SHIFT 12 #else #define SYS_mmap2 SYS_mmap #define MMAP2_PAGE_SHIFT 0 #endif +#if !(defined(__UCLIBC__) || defined(__GLIBC__)) +typedef off_t __off_t; +#endif #endif #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) --- a/lib/libv4l1/v4l1compat.c +++ b/lib/libv4l1/v4l1compat.c @@ -62,7 +62,7 @@ LIBV4L_PUBLIC int open(const char *file, return fd; } -#ifdef linux +#if defined(linux) && (defined(__GLIBC__) || defined(__UCLIBC__)) LIBV4L_PUBLIC int open64(const char *file, int oflag, ...) { int fd; @@ -94,7 +94,11 @@ LIBV4L_PUBLIC int dup(int fd) return v4l1_dup(fd); } +#ifdef HAVE_POSIX_IOCTL +LIBV4L_PUBLIC int ioctl(int fd, int request, ...) +#else LIBV4L_PUBLIC int ioctl(int fd, unsigned long int request, ...) +#endif { void *arg; va_list ap; @@ -112,12 +116,12 @@ LIBV4L_PUBLIC ssize_t read(int fd, void } LIBV4L_PUBLIC void *mmap(void *start, size_t length, int prot, int flags, int fd, - __off_t offset) + off_t offset) { return v4l1_mmap(start, length, prot, flags, fd, offset); } -#ifdef linux +#if defined(linux) && (defined(__GLIBC__) || defined(__UCLIBC__)) LIBV4L_PUBLIC void *mmap64(void *start, size_t length, int prot, int flags, int fd, __off64_t offset) { --- a/lib/libv4l2/v4l2convert.c +++ b/lib/libv4l2/v4l2convert.c @@ -86,7 +86,7 @@ LIBV4L_PUBLIC int open(const char *file, return fd; } -#ifdef linux +#if defined(linux) && (defined(__GLIBC__) || defined(__UCLIBC__)) LIBV4L_PUBLIC int open64(const char *file, int oflag, ...) { int fd; @@ -121,7 +121,11 @@ LIBV4L_PUBLIC int dup(int fd) return v4l2_dup(fd); } +#ifdef HAVE_POSIX_IOCTL +LIBV4L_PUBLIC int ioctl(int fd, int request, ...) +#else LIBV4L_PUBLIC int ioctl(int fd, unsigned long int request, ...) +#endif { void *arg; va_list ap; @@ -144,7 +148,7 @@ LIBV4L_PUBLIC void *mmap(void *start, si return v4l2_mmap(start, length, prot, flags, fd, offset); } -#ifdef linux +#if defined(linux) && (defined(__GLIBC__) || defined(__UCLIBC__)) LIBV4L_PUBLIC void *mmap64(void *start, size_t length, int prot, int flags, int fd, __off64_t offset) {