zoneminder has fallback code, they just unconditionally include zm_sendfile.h even where sendfile was not detected, and that has a hard #error. See https://github.com/jasperla/openbsd-wip/tree/master/multimedia/zoneminder, there is a patch for this.

--
 Sent from a phone, apologies for poor formatting.

On 19 November 2021 05:31:32 George Koehler <kern...@gmail.com> wrote:

On Thu, 18 Nov 2021 18:04:26 -0800
Steve Williams <st...@williamsitconsulting.com> wrote:

Hi,

I'm trying to compile a Linux/FreeBSD application (zoneminder) under
OpenBSD 7.0.

I'm slowly working through it but have gotten stuck at the point where
it has a dependency on sendfile(2) which OpenBSD doesn't have.

Doing some research, I found one reference that sosplice(2) might be
able to be used in place of sendfile.  Elsewhere, I have found reference
to a "simple-sendfile" package, but that doesn't seem to exist.

Linux sendfile(2) and FreeBSD sendfile(2) are different functions.
simple_sendfile() is a function in lang/ruby that wraps FreeBSD's
sendfile to act like Linux's.  simple_sendfile() is not for OpenBSD.

Linux: https://man7.org/linux/man-pages/man2/sendfile.2.html
FreeBSD: https://www.freebsd.org/cgi/man.cgi?query=sendfile
simple_sendfile: https://github.com/ruby/ruby/blob/0db68f023372b634603c74fca94588b457be084c/io.c#L11320

OpenBSD's SO_SPLICE can only "splice together two TCP or UDP sockets",
says setsockopt(2).  You can't SO_SPLICE if your code copies a regular
file to a socket.

Is this an issue people have already resolved with other ports?  Or is
it a deal breaker?

I guess the devil is in the details, but I thought I'd reach out here
first in case there's already a good solution to this.

Check what your code does if sendfile fails.  If it falls back to a
read/write loop, then you might patch it to skip sendfile.  If it
doesn't have a read/write loop, then you might need to add one.

--George


Thanks,
Steve Williams


Reply via email to