Impproved fix of PR12796, from Frederick Bruckman <fb@enteract.com>

This commit is contained in:
augustss 2001-05-10 01:53:48 +00:00
parent 63181d71c1
commit 5a71cdbf26

View File

@ -1,4 +1,4 @@
/* $NetBSD: ossaudio.c,v 1.13 2001/05/09 21:49:58 augustss Exp $ */
/* $NetBSD: ossaudio.c,v 1.14 2001/05/10 01:53:48 augustss Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -333,16 +333,27 @@ audio_ioctl(int fd, unsigned long com, void *argp)
INTARG = idat;
break;
case SNDCTL_DSP_GETOSPACE:
retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo);
if (retval < 0)
return retval;
setblocksize(fd, &tmpinfo);
bufinfo.fragsize = tmpinfo.blocksize;
bufinfo.fragments = tmpinfo.hiwat -
(tmpinfo.play.seek + tmpinfo.blocksize - 1)/tmpinfo.blocksize;
bufinfo.fragstotal = tmpinfo.hiwat;
bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.play.seek;
*(struct audio_buf_info *)argp = bufinfo;
break;
case SNDCTL_DSP_GETISPACE:
retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo);
if (retval < 0)
return retval;
setblocksize(fd, &tmpinfo);
bufinfo.fragsize = tmpinfo.blocksize;
bufinfo.fragments = tmpinfo.hiwat - tmpinfo.play.seek /
bufinfo.fragsize;
bufinfo.fragments = tmpinfo.hiwat -
(tmpinfo.record.seek + tmpinfo.blocksize - 1)/tmpinfo.blocksize;
bufinfo.fragstotal = tmpinfo.hiwat;
bufinfo.bytes = tmpinfo.play.buffer_size;
bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.record.seek;
*(struct audio_buf_info *)argp = bufinfo;
break;
case SNDCTL_DSP_NONBLOCK: