1
0
Fork 0
qemu/debian/patches/gnu-hurd.patch
Daniel Baumann 665688c177
Adding debian version 1:10.0.2+ds-1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-22 14:27:18 +02:00

61 lines
2.1 KiB
Diff

From: Michael Tokarev <mjt@tls.msk.ru>
Date: Sat, 24 Aug 2024 08:00:35 +0300
Updated: Mon, 02 Dec 2024 17:14:04 +0300
Subject: Add OS detection and support for GNU/Hurd
Forwarded: not-needed
Adds minimal (just OS detection) "support" for
GNU/Hurd. Just a test for now.
diff --git a/configure b/configure
index 0aea9b113b..0648634636 100755
--- a/configure
+++ b/configure
@@ -353,2 +353,4 @@ elif check_define __NetBSD__; then
host_os=netbsd
+elif check_define __GNU__; then
+ host_os=hurd
elif check_define __APPLE__; then
diff --git a/meson.build b/meson.build
index 91a0aa64c6..12246a588d 100644
--- a/meson.build
+++ b/meson.build
@@ -46,3 +46,3 @@ qapi_trace_events = []
bsd_oses = ['gnu/kfreebsd', 'freebsd', 'netbsd', 'openbsd', 'dragonfly', 'darwin']
-supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
+supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux', 'hurd']
supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv32', 'riscv64', 'x86', 'x86_64',
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index c7053cdc2b..560ed59ac0 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -135,4 +135,11 @@ QEMU_EXTERN_C int daemon(int, int);
+#if defined(__GNU__) && !defined(PATH_MAX) /* GNU Hurd */
+# define PATH_MAX 4096
+#endif
+
#ifdef CONFIG_IOVEC
#include <sys/uio.h>
+# if defined(__GNU__) && !defined(IOV_MAX) /* GNU Hurd */
+# define IOV_MAX 1024
+# endif
#endif
diff --git a/block/file-posix.c b/block/file-posix.c
index ff928b5e85..bf165a5a71 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -85,4 +85,7 @@
#endif
#endif
+#ifdef __GNU__
+#include <sys/ioctl.h>
+#endif
#if defined(CONFIG_FALLOCATE_PUNCH_HOLE) || defined(CONFIG_FALLOCATE_ZERO_RANGE)
#include <linux/falloc.h>
@@ -2004,4 +2007,5 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque)
#ifndef HAVE_COPY_FILE_RANGE
+#define copy_file_range qemu_copy_file_range
static off_t copy_file_range(int in_fd, off_t *in_off, int out_fd,
off_t *out_off, size_t len, unsigned int flags)