/dev/dsp mmap question
Andriy Gapon
avg at freebsd.org
Sat Feb 26 15:18:27 UTC 2011
Guys,
if we the following on FreeBSD (pseudo-code):
fd = open(/dev/dsp, O_RDWR);
mmap(PROT_READ, fd);
mmap(PROT_WRITE, fd);
This won't work entirely correctly, right?
I base my question on some observations of how a particular program behaves on
FreeBSD and on the following comment in sys/dev/sound/pcm/dsp.c:
/*
* XXX The linux api uses the nprot to select read/write buffer
* our vm system doesn't allow this, so force write buffer.
*
* This is just a quack to fool full-duplex mmap, so that at
* least playback _or_ recording works. If you really got the
* urge to make _both_ work at the same time, avoid O_RDWR.
* Just open each direction separately and mmap() it.
*
* Failure is not an option due to INVARIANTS check within
* device_pager.c, which means, we have to give up one over
* another.
*/
P.S.
is this something that can easily fixed or not?
--
Andriy Gapon
More information about the freebsd-multimedia
mailing list