Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Feb 2011 17:18:22 +0200
From:      Andriy Gapon <avg@freebsd.org>
To:        freebsd-multimedia@freebsd.org
Cc:        freebsd-hackers@freebsd.org
Subject:   /dev/dsp mmap question
Message-ID:  <4D6919BE.3090003@freebsd.org>

next in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D6919BE.3090003>