Still waiting for pkg_add and then my build to finish, but the idea is

- make the existing maros NO-OPs, align with spaces to make it obvious
- remove includes/defines to break any left-over syscalls

I didn't see a knob to fix this properly.

Index: Makefile
===================================================================
RCS file: /cvs/ports/multimedia/libv4l/Makefile,v
retrieving revision 1.29
diff -u -p -r1.29 Makefile
--- Makefile    2 Sep 2022 09:42:27 -0000       1.29
+++ Makefile    19 Feb 2023 18:19:57 -0000
@@ -3,7 +3,7 @@ COMMENT =               libv4l userspace library
 VERSION =              1.20.0
 DISTNAME =             v4l-utils-${VERSION}
 PKGNAME =              libv4l-${VERSION}
-REVISION =             2
+REVISION =             3
 
 SHARED_LIBS += v4l1            0.0 # 0.0
 SHARED_LIBS += v4l2            0.0 # 0.0
Index: patches/patch-lib_libv4l-mplane_libv4l-mplane_c
===================================================================
RCS file: patches/patch-lib_libv4l-mplane_libv4l-mplane_c
diff -N patches/patch-lib_libv4l-mplane_libv4l-mplane_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_libv4l-mplane_libv4l-mplane_c     19 Feb 2023 18:37:13 
-0000
@@ -0,0 +1,20 @@
+Stub out SYS_* macros to use syscalls directly not syscall(2)
+
+Index: lib/libv4l-mplane/libv4l-mplane.c
+--- lib/libv4l-mplane/libv4l-mplane.c.orig
++++ lib/libv4l-mplane/libv4l-mplane.c
+@@ -36,11 +36,11 @@
+ #include "libv4l-plugin.h"
+ 
+ #define SYS_IOCTL(fd, cmd, arg) \
+-      syscall(SYS_ioctl, (int)(fd), (unsigned long)(cmd), (void *)(arg))
++            ioctl(fd, cmd, arg)
+ #define SYS_READ(fd, buf, len) \
+-      syscall(SYS_read, (int)(fd), (void *)(buf), (size_t)(len));
++            read(fd, buf, len)
+ #define SYS_WRITE(fd, buf, len) \
+-      syscall(SYS_write, (int)(fd), (const void *)(buf), (size_t)(len));
++            write(fd, buf, len)
+ 
+ 
+ #if HAVE_VISIBILITY
Index: patches/patch-lib_libv4l1_libv4l1_c
===================================================================
RCS file: patches/patch-lib_libv4l1_libv4l1_c
diff -N patches/patch-lib_libv4l1_libv4l1_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_libv4l1_libv4l1_c 19 Feb 2023 18:37:13 -0000
@@ -0,0 +1,14 @@
+Use dup(2) not syscall(2)
+
+Index: lib/libv4l1/libv4l1.c
+--- lib/libv4l1/libv4l1.c.orig
++++ lib/libv4l1/libv4l1.c
+@@ -472,7 +472,7 @@ int v4l1_dup(int fd)
+       int index = v4l1_get_index(fd);
+ 
+       if (index == -1)
+-              return syscall(SYS_dup, fd);
++              return dup(fd);
+ 
+       devices[index].open_count++;
+ 
Index: patches/patch-lib_libv4l2_libv4l2_c
===================================================================
RCS file: patches/patch-lib_libv4l2_libv4l2_c
diff -N patches/patch-lib_libv4l2_libv4l2_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_libv4l2_libv4l2_c 19 Feb 2023 18:37:13 -0000
@@ -0,0 +1,14 @@
+Use dup(2) not syscall(2)
+
+Index: lib/libv4l2/libv4l2.c
+--- lib/libv4l2/libv4l2.c.orig
++++ lib/libv4l2/libv4l2.c
+@@ -880,7 +880,7 @@ int v4l2_dup(int fd)
+       int index = v4l2_get_index(fd);
+ 
+       if (index == -1)
+-              return syscall(SYS_dup, fd);
++              return dup(fd);
+ 
+       devices[index].open_count++;
+ 
Index: patches/patch-lib_libv4lconvert_libv4lsyscall-priv_h
===================================================================
RCS file: patches/patch-lib_libv4lconvert_libv4lsyscall-priv_h
diff -N patches/patch-lib_libv4lconvert_libv4lsyscall-priv_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_libv4lconvert_libv4lsyscall-priv_h        19 Feb 2023 
18:37:13 -0000
@@ -0,0 +1,59 @@
+Stub out SYS_* macros to use syscalls directly not syscall(2)
+
+Index: lib/libv4lconvert/libv4lsyscall-priv.h
+--- lib/libv4lconvert/libv4lsyscall-priv.h.orig
++++ lib/libv4lconvert/libv4lsyscall-priv.h
+@@ -63,15 +63,6 @@
+ #define       MMAP2_PAGE_SHIFT 0
+ #endif
+ 
+-#if defined(__OpenBSD__)
+-#include <sys/syscall.h>
+-#include <sys/types.h>
+-#include <sys/ioctl.h>
+-#define       _IOC_NR(cmd) ((cmd) & 0xFF)
+-#define       _IOC_TYPE(cmd) IOCGROUP(cmd)
+-#define       MMAP2_PAGE_SHIFT 0
+-#endif
+-
+ #undef SYS_OPEN
+ #undef SYS_CLOSE
+ #undef SYS_IOCTL
+@@ -84,19 +75,19 @@
+ 
+ #ifdef SYS_openat
+ #define SYS_OPEN(file, oflag, mode) \
+-      syscall(SYS_openat, AT_FDCWD, (const char *)(file), (int)(oflag), 
(mode_t)(mode))
++            open(file, oflag, mode)
+ #else
+ #define SYS_OPEN(file, oflag, mode) \
+-      syscall(SYS_open, (const char *)(file), (int)(oflag), (mode_t)(mode))
++            open(file, oflag, mode)
+ #endif
+ #define SYS_CLOSE(fd) \
+-      syscall(SYS_close, (int)(fd))
++            close(fd)
+ #define SYS_IOCTL(fd, cmd, arg) \
+-      syscall(SYS_ioctl, (int)(fd), (unsigned long)(cmd), (void *)(arg))
++            ioctl(fd, cmd, arg)
+ #define SYS_READ(fd, buf, len) \
+-      syscall(SYS_read, (int)(fd), (void *)(buf), (size_t)(len));
++            read(fd, buf, len)
+ #define SYS_WRITE(fd, buf, len) \
+-      syscall(SYS_write, (int)(fd), (const void *)(buf), (size_t)(len));
++            write(fd, buf, len)
+ 
+ #if defined(__FreeBSD__)
+ #define SYS_MMAP(addr, len, prot, flags, fd, off) \
+@@ -107,10 +98,8 @@
+       syscall(SYS_mmap, (void *)(addr), (size_t)(len), \
+                       (int)(prot), (int)(flags), (int)(fd), (off_t)(off))
+ #elif defined(__OpenBSD__)
+-register_t __syscall(quad_t, ...);
+ #define SYS_MMAP(addr, len, prot, flags, fd, offset) \
+-      __syscall((quad_t)SYS_mmap, (void *)(addr), (size_t)(len), \
+-                      (int)(prot), (int)(flags), (int)(fd), 0, 
(off_t)(offset))
++            mmap(addr, len, prot, flags, fd, offset)
+ #else
+ #define SYS_MMAP(addr, len, prot, flags, fd, off) \
+       syscall(SYS_mmap2, (void *)(addr), (size_t)(len), \

Reply via email to