1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
$NetBSD: patch-ad,v 1.4 2010/12/27 04:58:10 obache Exp $
* XXX
* `mode_t' is promoted to `int' when passwd through `...'.
--- libv4l2/libv4l2.c.orig 2008-09-03 10:23:46.000000000 +0000
+++ libv4l2/libv4l2.c
@@ -59,7 +59,11 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#ifdef __linux__
#include <syscall.h>
+#else
+#include <sys/syscall.h>
+#endif
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
@@ -69,6 +73,10 @@
#include "libv4l2.h"
#include "libv4l2-priv.h"
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
/* Note these flags are stored together with the flags passed to v4l2_fd_open()
in v4l2_dev_info's flags member, so care should be taken that the do not
use the same bits! */
@@ -154,7 +162,7 @@ static int v4l2_map_buffers(int index)
break;
}
- devices[index].frame_pointers[i] = (void *)syscall(SYS_mmap2, NULL,
+ devices[index].frame_pointers[i] = mmap(NULL,
(size_t)buf.length, PROT_READ|PROT_WRITE, MAP_SHARED, devices[index].fd,
(__off_t)(buf.m.offset >> MMAP2_PAGE_SHIFT));
if (devices[index].frame_pointers[i] == MAP_FAILED) {
@@ -408,7 +416,7 @@ int v4l2_open (const char *file, int ofl
mode_t mode;
va_start (ap, oflag);
- mode = va_arg (ap, mode_t);
+ mode = (mode_t)va_arg (ap, int);
fd = syscall(SYS_open, file, oflag, mode);
@@ -871,7 +879,7 @@ int v4l2_ioctl (int fd, unsigned long in
but we need the buffer _now_ to write our converted data
to it! */
if (devices[index].convert_mmap_buf == MAP_FAILED) {
- devices[index].convert_mmap_buf = (void *)syscall(SYS_mmap2,
+ devices[index].convert_mmap_buf = mmap(NULL,
(size_t)(
devices[index].no_frames *
V4L2_FRAME_BUF_SIZE),
@@ -995,7 +1003,7 @@ void *v4l2_mmap(void *start, size_t leng
return MAP_FAILED;
}
- return (void *)syscall(SYS_mmap2, start, length, prot, flags, fd,
+ return mmap(start, length, prot, flags, fd,
(__off_t)(offset >> MMAP2_PAGE_SHIFT));
}
@@ -1012,7 +1020,7 @@ void *v4l2_mmap(void *start, size_t leng
}
if (devices[index].convert_mmap_buf == MAP_FAILED) {
- devices[index].convert_mmap_buf = (void *)syscall(SYS_mmap2, NULL,
+ devices[index].convert_mmap_buf = mmap(NULL,
(size_t)(
devices[index].no_frames *
V4L2_FRAME_BUF_SIZE),
|