Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/ossaudio Improved fix of PR12796, from Frederick ...



details:   https://anonhg.NetBSD.org/src/rev/3d044d72ab3f
branches:  trunk
changeset: 509678:3d044d72ab3f
user:      augustss <augustss%NetBSD.org@localhost>
date:      Thu May 10 01:54:30 2001 +0000

description:
Improved fix of PR12796, from Frederick Bruckman <fb%enteract.com@localhost>

diffstat:

 sys/compat/ossaudio/ossaudio.c |  27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r bf5943905e22 -r 3d044d72ab3f sys/compat/ossaudio/ossaudio.c
--- a/sys/compat/ossaudio/ossaudio.c    Thu May 10 01:53:48 2001 +0000
+++ b/sys/compat/ossaudio/ossaudio.c    Thu May 10 01:54:30 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ossaudio.c,v 1.34 2001/05/09 21:50:50 augustss Exp $   */
+/*     $NetBSD: ossaudio.c,v 1.35 2001/05/10 01:54:30 augustss Exp $   */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -397,16 +397,33 @@
                        goto out;
                break;
        case OSS_SNDCTL_DSP_GETOSPACE:
+               error = ioctlf(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
+               if (error)
+                       goto out;
+               setblocksize(fp, &tmpinfo, p);
+               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;
+               error = copyout(&bufinfo, SCARG(uap, data), sizeof bufinfo);
+               if (error)
+                       goto out;
+               break;
        case OSS_SNDCTL_DSP_GETISPACE:
                error = ioctlf(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
                if (error)
                        goto out;
                setblocksize(fp, &tmpinfo, p);
                bufinfo.fragsize = tmpinfo.blocksize;
-               bufinfo.fragments = tmpinfo.hiwat - tmpinfo.play.seek / 
-                                                   bufinfo.fragsize;
-               bufinfo.fragstotal = tmpinfo.hiwat;
-               bufinfo.bytes = tmpinfo.play.buffer_size;
+               bufinfo.fragments = tmpinfo.hiwat -
+                   (tmpinfo.record.seek + tmpinfo.blocksize - 1) /
+                   tmpinfo.blocksize;
+                bufinfo.fragstotal = tmpinfo.hiwat;
+               bufinfo.bytes =
+                   tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.record.seek;
                DPRINTF(("oss_sys_ioctl: SNDCTL_DSP_GETxSPACE = %d %d %d %d\n",
                         bufinfo.fragsize, bufinfo.fragments, 
                         bufinfo.fragstotal, bufinfo.bytes));



Home | Main Index | Thread Index | Old Index