From a90f8132a7668861aad3d53075b953c7d5766f30 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 21 May 2001 01:13:44 +0000 Subject: [PATCH] make the rw selection do the right thing elsewhere --- source/snd_oss.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/snd_oss.c b/source/snd_oss.c index f1acf4c..76a1464 100644 --- a/source/snd_oss.c +++ b/source/snd_oss.c @@ -81,19 +81,22 @@ SNDDMA_Init (void) int caps; int retries = 3; int omode = O_WRONLY; + int mmmode = PROT_WRITE; snd_inited = 0; // open /dev/dsp, confirm capability to mmap, and get size of dma buffer - if (COM_CheckParm ("-sndrw")) + if (COM_CheckParm ("-sndrw")) { omode = O_RDWR; + mmmode |= PROT_READ; + } audio_fd = open ("/dev/dsp", omode); if (audio_fd < 0) { // Failed open, retry up to 3 times // if it's busy while ((audio_fd < 0) && retries-- && ((errno == EAGAIN) || (errno == EBUSY))) { sleep (1); - audio_fd = open ("/dev/dsp", O_RDWR); + audio_fd = open ("/dev/dsp", omode); } if (audio_fd < 0) { perror ("/dev/dsp"); @@ -180,7 +183,7 @@ SNDDMA_Init (void) // memory map the dma buffer shm->buffer = (unsigned char *) mmap (NULL, info.fragstotal * info.fragsize, - PROT_READ | PROT_WRITE, + mmmode, MAP_FILE | MAP_SHARED, audio_fd, 0); if (shm->buffer == MAP_FAILED) {