From patchwork Sat Jan 9 21:05:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juergen Lock X-Patchwork-Id: 42564 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 78C2E1007D2 for ; Sun, 10 Jan 2010 09:08:22 +1100 (EST) Received: from localhost ([127.0.0.1]:33753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NTjQK-0006hb-SX for incoming@patchwork.ozlabs.org; Sat, 09 Jan 2010 17:04:44 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NTjNf-0005qJ-0g for qemu-devel@nongnu.org; Sat, 09 Jan 2010 17:01:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NTjNd-0005nf-Fm for qemu-devel@nongnu.org; Sat, 09 Jan 2010 17:01:58 -0500 Received: from [199.232.76.173] (port=60694 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NTjNd-0005nV-7C for qemu-devel@nongnu.org; Sat, 09 Jan 2010 17:01:57 -0500 Received: from gelbbaer.kn-bremen.de ([78.46.108.116]:36036 helo=smtp.kn-bremen.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NTjNc-0003MV-FK for qemu-devel@nongnu.org; Sat, 09 Jan 2010 17:01:56 -0500 Received: by smtp.kn-bremen.de (Postfix, from userid 10) id 5B19B1E00764; Sat, 9 Jan 2010 23:01:53 +0100 (CET) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.3/8.14.3) with ESMTP id o09L57mM092727 for ; Sat, 9 Jan 2010 22:05:07 +0100 (CET) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.3/8.14.3/Submit) id o09L570b092726 for qemu-devel@nongnu.org; Sat, 9 Jan 2010 22:05:07 +0100 (CET) (envelope-from nox) From: Juergen Lock Date: Sat, 9 Jan 2010 22:05:07 +0100 To: qemu-devel@nongnu.org Message-ID: <20100109210507.GA92510@triton8.kn-bremen.de> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH] Workaround for broken OSS_GETVERSION on FreeBSD, part two X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 (which atm is 0x040000) if the ioctl is defined but fails. Signed-off-by: Juergen Lock --- 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 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) {