ports/emulators/qemu-devel/files/patch-block-raw.c
Juergen Lock 332215d971 update qemu to 20061225 snapshot:
- Enable TCP_NODELAY, by Daniel Jacobowitz. [speeding up slirp]
- Run monitor over unix domain sockets, by Anthony Liguori.
- Unix domain socket support for VNC, by Anthony Liguori.
- Daemonize option, by Anthony Liguori.
- SCSI emulation improvements, by Chuck Brazie.
[adding scsi disk/cdrom emulation to i386/amd64 guests using new -disk
syntax - quoting /usr/local/share/doc/qemu/qemu-doc.html:

 "-disk scsi,img=file[,sdx=a..g][,type=disk|cdrom][,id=n]"

    Use file as the SCSI disk/CD-ROM image. The defaults are: sdx=a,type=
    disk,id='auto assign'

doing a quick test with a FreeBSD guest I was able to mount and look at
a ufs partition; doesn't seem to quite work with (some?) linux guests
yet tho, will post about this on the qemu list...]
- and a few bug fixes.

Approved by:	miwi (mentor)
2006-12-25 19:49:52 +00:00

49 lines
1.1 KiB
C

Index: qemu/block-raw.c
@@ -51,7 +51,7 @@
#include <linux/cdrom.h>
#include <linux/fd.h>
#endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) && __FreeBSD__ > 4
#include <sys/disk.h>
#endif
@@ -167,9 +167,20 @@
static int aio_sig_num = SIGUSR2;
static RawAIOCB *first_aio; /* AIO issued */
static int aio_initialized = 0;
+// FreeBSD 4.x doesn't have sigwait
+#if defined(__FreeBSD__) && __FreeBSD__ <= 4
+static int sigaio_dont = 0;
+#endif
static void aio_signal_handler(int signum)
{
+// FreeBSD 4.x doesn't have sigwait
+#if defined(__FreeBSD__) && __FreeBSD__ <= 4
+ if (sigaio_dont) {
+ --sigaio_dont;
+ return;
+ }
+#endif
#ifndef QEMU_TOOL
CPUState *env = cpu_single_env;
if (env) {
@@ -284,9 +295,17 @@
if (qemu_bh_poll())
return;
#endif
+// FreeBSD 4.x doesn't have sigwait
+#if defined(__FreeBSD__) && __FreeBSD__ <= 4
+ ++sigaio_dont;
+ do
+ sigsuspend(&wait_oset);
+ while (sigaio_dont);
+#else
sigemptyset(&set);
sigaddset(&set, aio_sig_num);
sigwait(&set, &nb_sigs);
+#endif
qemu_aio_poll();
}