aboutsummaryrefslogtreecommitdiff
path: root/audio/ossaudio.c
diff options
context:
space:
mode:
authormalc <av1474@comtv.ru>2009-09-11 10:13:55 +0400
committermalc <av1474@comtv.ru>2009-09-12 02:50:58 +0400
commit2182349d736e8548f122b091731025f5ed63f670 (patch)
treefea6e9b848b263bb01b932032803dc984b05125f /audio/ossaudio.c
parent2637c754ccdb286890ed2a8d0d1da775dbd062af (diff)
oss: Unbreak mmaping the ability to mmap oss fd on Linux
Signed-off-by: malc <av1474@comtv.ru>
Diffstat (limited to 'audio/ossaudio.c')
-rw-r--r--audio/ossaudio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 18152b535c..e4f90f2029 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -205,13 +205,16 @@ static int oss_open (int in, struct oss_params *req,
struct oss_params *obt, int *pfd)
{
int fd;
+ int oflags;
int mmmmssss;
audio_buf_info abinfo;
int fmt, freq, nchannels;
const char *dspname = in ? conf.devpath_in : conf.devpath_out;
const char *typ = in ? "ADC" : "DAC";
- fd = open (dspname, (in ? O_RDONLY : O_WRONLY) | O_NONBLOCK);
+ /* Kludge needed to have working mmap on Linux */
+ oflags = conf.try_mmap ? O_RDWR : (in ? O_RDONLY : O_WRONLY);
+ fd = open (dspname, oflags | O_NONBLOCK);
if (-1 == fd) {
oss_logerr2 (errno, typ, "Failed to open `%s'\n", dspname);
return -1;