qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [COMMIT 2182349] oss: Unbreak mmaping the ability to mmap


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT 2182349] oss: Unbreak mmaping the ability to mmap oss fd onLinux
Date: Fri, 11 Sep 2009 23:37:28 -0000

From: malc <address@hidden>

Signed-off-by: malc <address@hidden>

diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 18152b5..e4f90f2 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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]