qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: malc <av1474@comtv.ru>
To: Juergen Lock <nox@jelal.kn-bremen.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Workaround for broken OSS_GETVERSION on FreeBSD, part two
Date: Sun, 10 Jan 2010 01:40:18 +0300 (MSK)	[thread overview]
Message-ID: <Pine.LNX.4.64.1001100136150.5335@linmac.oyster.ru> (raw)
In-Reply-To: <20100109210507.GA92510@triton8.kn-bremen.de>

On Sat, 9 Jan 2010, Juergen Lock wrote:

> 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.

I've changed the code in the meantime, so this wont apply. Also this
is wrong version is dynamic by nature, if someone runs qemu on FreeBSD
where SOUND_VERSION is less than 4, things will get ugly.

In the new code i mentioned one can opt for not considering POLICY
failure a hard error and proceed with a SETFRAGMENT path, which is
what i would prefer to see on FreeBSD.

> 
>  Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
> 
> --- 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) {
> 
> 

-- 
mailto:av1474@comtv.ru

  reply	other threads:[~2010-01-09 22:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-09 21:05 [Qemu-devel] [PATCH] Workaround for broken OSS_GETVERSION on FreeBSD, part two Juergen Lock
2010-01-09 22:40 ` malc [this message]
2010-01-10 18:57   ` Juergen Lock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.1001100136150.5335@linmac.oyster.ru \
    --to=av1474@comtv.ru \
    --cc=nox@jelal.kn-bremen.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).