--- channel.c Sun Nov 9 04:17:22 2003 +++ /sys/dev/sound/pcm/channel.c Wed Nov 26 02:21:14 2003 @@ -250,6 +250,8 @@ { int ret, timeout, newsize, count, sz; struct snd_dbuf *bs = c->bufsoft; + void *off; + int t, x,togo,p; CHN_LOCKASSERT(c); /* @@ -291,7 +293,22 @@ sz = MIN(sz, buf->uio_resid); KASSERT(sz > 0, ("confusion in chn_write")); /* printf("sz: %d\n", sz); */ +#if 0 ret = sndbuf_uiomove(bs, buf, sz); +#else + togo = sz; + while (ret == 0 && togo> 0) { + p = sndbuf_getfreeptr(bs); + t = MIN(togo, sndbuf_getsize(bs) - p); + off = sndbuf_getbufofs(bs, p); + CHN_UNLOCK(c); + ret = uiomove(off, t, buf); + CHN_LOCK(c); + togo -= t; + x = sndbuf_acquire(bs, NULL, t); + } + ret = 0; +#endif if (ret == 0 && !(c->flags & CHN_F_TRIGGERED)) chn_start(c, 0); }