On 8/5/24 09:44, Stefano Garzarella wrote:
The vhost-user protocol is not really Linux-specific so let's enable
libvhost-user for any POSIX system.
Compiling it on macOS and FreeBSD some problems came up:
- avoid to include linux/vhost.h which is avaibale only on Linux
"available"
(vhost_types.h contains many of the things we need)
- macOS doesn't provide sys/endian.h, so let's define them
(note: libvhost-user doesn't include qemu's headers, so we can't use
"QEMU"
use "qemu/bswap.h")
- define eventfd_[write|read] as write/read wrapper when system doesn't
provide those (e.g. macOS)
- copy SEAL defines from include/qemu/memfd.h to make the code works
on FreeBSD where MFD_ALLOW_SEALING is defined
Alternatively add in subprojects/libvhost-user/include/osdep.h.
- define MAP_NORESERVE if it's not defined (e.g. on FreeBSD)
Signed-off-by: Stefano Garzarella <sgarz...@redhat.com>
---
meson.build | 2 +-
subprojects/libvhost-user/libvhost-user.h | 2 +-
subprojects/libvhost-user/libvhost-user.c | 60 +++++++++++++++++++++--
3 files changed, 59 insertions(+), 5 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>
Tested-by: Philippe Mathieu-Daudé <phi...@linaro.org>