$NetBSD: patch-am,v 1.5 2016/08/28 15:48:32 wiz Exp $ * XXXX * `mode_t' is promoted to `int' when passed through `...'. * Fix SunOS 64-bit --- libv4l1/v4l1compat.c.orig 2008-08-26 12:32:39.000000000 +0000 +++ libv4l1/v4l1compat.c @@ -40,6 +40,10 @@ #define LIBV4L_PUBLIC #endif +#ifndef O_LARGEFILE +#define O_LARGEFILE 0 +#endif + LIBV4L_PUBLIC int open (const char *file, int oflag, ...) { int fd; @@ -50,7 +54,7 @@ LIBV4L_PUBLIC int open (const char *file mode_t mode; va_start (ap, oflag); - mode = va_arg (ap, mode_t); + mode = (sizeof (mode_t) < sizeof (int) ? (mode_t)va_arg (ap, int) : va_arg (ap, mode_t)); fd = v4l1_open(file, oflag, mode); @@ -61,6 +65,7 @@ LIBV4L_PUBLIC int open (const char *file return fd; } +#if !(defined(__sun) && defined(_LP64)) LIBV4L_PUBLIC int open64 (const char *file, int oflag, ...) { int fd; @@ -71,7 +76,7 @@ LIBV4L_PUBLIC int open64 (const char *fi mode_t mode; va_start (ap, oflag); - mode = va_arg (ap, mode_t); + mode = (mode_t)va_arg (ap, int); fd = v4l1_open(file, oflag | O_LARGEFILE, mode); @@ -81,6 +86,7 @@ LIBV4L_PUBLIC int open64 (const char *fi return fd; } +#endif LIBV4L_PUBLIC int close(int fd) { return v4l1_close(fd); @@ -103,22 +109,19 @@ LIBV4L_PUBLIC int ioctl (int fd, unsigne return v4l1_ioctl (fd, request, arg); } -LIBV4L_PUBLIC ssize_t read(int fd, void* buffer, size_t n) -{ - return v4l1_read (fd, buffer, n); -} - LIBV4L_PUBLIC void *mmap(void *start, size_t length, int prot, int flags, int fd, __off_t offset) { return v4l1_mmap(start, length, prot, flags, fd, offset); } +#if !(defined(__sun) && defined(_LP64)) LIBV4L_PUBLIC void *mmap64(void *start, size_t length, int prot, int flags, int fd, __off64_t offset) { return v4l1_mmap(start, length, prot, flags, fd, offset); } +#endif LIBV4L_PUBLIC int munmap(void *start, size_t length) {