Fix minor bugs of SNDCTL_DSP_GETISPACE.

- hiwat is playback-only parameter.
- 'bytes' should not be rounded down.
This commit is contained in:
isaki 2019-02-02 04:52:16 +00:00
parent 3eb0897352
commit 8b1980912d
2 changed files with 10 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ossaudio.c,v 1.35 2019/01/29 11:54:02 isaki Exp $ */
/* $NetBSD: ossaudio.c,v 1.36 2019/02/02 04:52:16 isaki Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: ossaudio.c,v 1.35 2019/01/29 11:54:02 isaki Exp $");
__RCSID("$NetBSD: ossaudio.c,v 1.36 2019/02/02 04:52:16 isaki Exp $");
/*
* This is an OSS (Linux) sound API emulator.
@ -425,8 +425,9 @@ audio_ioctl(int fd, unsigned long com, void *argp)
setblocksize(fd, &tmpinfo);
bufinfo.fragsize = tmpinfo.blocksize;
bufinfo.fragments = tmpinfo.record.seek / tmpinfo.blocksize;
bufinfo.fragstotal = tmpinfo.hiwat;
bufinfo.bytes = bufinfo.fragments * tmpinfo.blocksize;
bufinfo.fragstotal =
tmpinfo.record.buffer_size / tmpinfo.blocksize;
bufinfo.bytes = tmpinfo.record.seek;
*(struct audio_buf_info *)argp = bufinfo;
break;
case SNDCTL_DSP_NONBLOCK:

View File

@ -1,4 +1,4 @@
/* $NetBSD: ossaudio.c,v 1.71 2019/01/29 12:01:20 isaki Exp $ */
/* $NetBSD: ossaudio.c,v 1.72 2019/02/02 04:52:16 isaki Exp $ */
/*-
* Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.71 2019/01/29 12:01:20 isaki Exp $");
__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.72 2019/02/02 04:52:16 isaki Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -642,8 +642,9 @@ oss_ioctl_audio(struct lwp *l, const struct oss_sys_ioctl_args *uap, register_t
setblocksize(fp, &tmpinfo);
bufinfo.fragsize = tmpinfo.blocksize;
bufinfo.fragments = tmpinfo.record.seek / tmpinfo.blocksize;
bufinfo.fragstotal = tmpinfo.hiwat;
bufinfo.bytes = bufinfo.fragments * tmpinfo.blocksize;
bufinfo.fragstotal =
tmpinfo.record.buffer_size / tmpinfo.blocksize;
bufinfo.bytes = tmpinfo.record.seek;
error = copyout(&bufinfo, SCARG(uap, data), sizeof bufinfo);
if (error) {
DPRINTF(("%s: SNDCTL_DSP_GETISPACE %d %d %d %d = %d\n",