Fix problem in ioctl() handling in OSS audio emulation which caused
unintentional changes of the audio settings e.g. when running "kphone". Patch submitted by George Michaelson on "tech-kern@NetBSD.org".
This commit is contained in:
parent
efc3770d53
commit
9ca15b486f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ossaudio.c,v 1.47 2005/02/26 23:10:21 perry Exp $ */
|
||||
/* $NetBSD: ossaudio.c,v 1.48 2005/12/08 19:19:14 tron Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.47 2005/02/26 23:10:21 perry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.48 2005/12/08 19:19:14 tron Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
|
@ -127,7 +127,7 @@ oss_ioctl_audio(p, uap, retval)
|
|||
/* This call is merely advisory, and may be a nop. */
|
||||
break;
|
||||
case OSS_SNDCTL_DSP_SPEED:
|
||||
AUDIO_INITINFO(&tmpinfo);
|
||||
(void) ioctlf(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
|
||||
error = copyin(SCARG(uap, data), &idat, sizeof idat);
|
||||
if (error)
|
||||
goto out;
|
||||
|
@ -149,7 +149,7 @@ oss_ioctl_audio(p, uap, retval)
|
|||
goto out;
|
||||
break;
|
||||
case OSS_SNDCTL_DSP_STEREO:
|
||||
AUDIO_INITINFO(&tmpinfo);
|
||||
(void) ioctlf(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
|
||||
error = copyin(SCARG(uap, data), &idat, sizeof idat);
|
||||
if (error)
|
||||
goto out;
|
||||
|
@ -175,7 +175,7 @@ oss_ioctl_audio(p, uap, retval)
|
|||
goto out;
|
||||
break;
|
||||
case OSS_SNDCTL_DSP_SETFMT:
|
||||
AUDIO_INITINFO(&tmpinfo);
|
||||
(void) ioctlf(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
|
||||
error = copyin(SCARG(uap, data), &idat, sizeof idat);
|
||||
if (error)
|
||||
goto out;
|
||||
|
@ -278,7 +278,7 @@ oss_ioctl_audio(p, uap, retval)
|
|||
goto out;
|
||||
break;
|
||||
case OSS_SNDCTL_DSP_CHANNELS:
|
||||
AUDIO_INITINFO(&tmpinfo);
|
||||
(void) ioctlf(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
|
||||
error = copyin(SCARG(uap, data), &idat, sizeof idat);
|
||||
if (error)
|
||||
goto out;
|
||||
|
@ -310,7 +310,7 @@ oss_ioctl_audio(p, uap, retval)
|
|||
if (idat == 0)
|
||||
idat = tmpinfo.play.buffer_size / tmpinfo.blocksize;
|
||||
idat = (tmpinfo.play.buffer_size / idat) & -4;
|
||||
AUDIO_INITINFO(&tmpinfo);
|
||||
(void) ioctlf(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
|
||||
tmpinfo.blocksize = idat;
|
||||
error = ioctlf(fp, AUDIO_SETINFO, (caddr_t)&tmpinfo, p);
|
||||
if (error)
|
||||
|
@ -321,7 +321,7 @@ oss_ioctl_audio(p, uap, retval)
|
|||
goto out;
|
||||
break;
|
||||
case OSS_SNDCTL_DSP_SETFRAGMENT:
|
||||
AUDIO_INITINFO(&tmpinfo);
|
||||
(void) ioctlf(fp, AUDIO_SETINFO, (caddr_t)&tmpinfo, p);
|
||||
error = copyin(SCARG(uap, data), &idat, sizeof idat);
|
||||
if (error)
|
||||
goto out;
|
||||
|
@ -467,7 +467,7 @@ oss_ioctl_audio(p, uap, retval)
|
|||
goto out;
|
||||
break;
|
||||
case OSS_SNDCTL_DSP_SETTRIGGER:
|
||||
AUDIO_INITINFO(&tmpinfo);
|
||||
(void) ioctlf(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
|
||||
error = copyin(SCARG(uap, data), &idat, sizeof idat);
|
||||
if (error)
|
||||
goto out;
|
||||
|
@ -1159,7 +1159,7 @@ setblocksize(fp, info, p)
|
|||
if (info->blocksize & (info->blocksize-1)) {
|
||||
for(s = 32; s < info->blocksize; s <<= 1)
|
||||
;
|
||||
AUDIO_INITINFO(&set);
|
||||
(void) fp->f_ops->fo_ioctl(fp, AUDIO_GETINFO, (caddr_t)&set, p);
|
||||
set.blocksize = s;
|
||||
fp->f_ops->fo_ioctl(fp, AUDIO_SETINFO, (caddr_t)&set, p);
|
||||
fp->f_ops->fo_ioctl(fp, AUDIO_GETINFO, (caddr_t)info, p);
|
||||
|
|
Loading…
Reference in New Issue