[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Workaround for broken OSS_GETVERSION on FreeBSD, pa
From: |
Juergen Lock |
Subject: |
[Qemu-devel] [PATCH] Workaround for broken OSS_GETVERSION on FreeBSD, part two |
Date: |
Sat, 9 Jan 2010 22:05:07 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Turns out on those versions of FreeBSD (>= 7.x) that know OSS_GETVERSION
the ioctl doesn't actually work yet (except in the Linuxolator), so if
building on FreeBSD fall back to using SOUND_VERSION as defined in
<sys/soundcard.h> (which atm is 0x040000) if the ioctl is defined but
fails.
Signed-off-by: Juergen Lock <address@hidden>
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -289,8 +289,25 @@ static int oss_open (int in, struct oss_
#ifdef USE_DSP_POLICY
if (ioctl (fd, OSS_GETVERSION, &version)) {
+#ifdef __FreeBSD__
+ /*
+ * Looks like atm (20100109) FreeBSD knows OSS_GETVERSION
+ * since 7.x, but currently only on the mixer device (or in
+ * the Linuxolator), and in the native version that part of
+ * the code is in fact never reached so the ioctl fails anyway.
+ * But since it just (attempts to) return SOUND_VERSION as
+ * defined in <sys/soundcard.h> we can fall back to getting it
+ * from there. (On FreeBSD, /usr/include is part of the base
+ * system which is assumed to be always in sync with the kernel.)
+ * XXX What if the user runs the original OSS from ports instead
+ * of FreeBSD's own code? Well I hope we can assume the ioctl
+ * works there... :)
+ */
+ version = SOUND_VERSION;
+#else
oss_logerr2 (errno, typ, "Failed to get OSS version\n");
version = 0;
+#endif
}
if (conf.debug) {
- [Qemu-devel] [PATCH] Workaround for broken OSS_GETVERSION on FreeBSD, part two,
Juergen Lock <=