make snd_oss_rw affect the rest of the places it needs to

This commit is contained in:
Bill Currie 2001-05-21 01:12:07 +00:00
parent ece576ed4b
commit f38a233786

View file

@ -108,6 +108,7 @@ SNDDMA_Init (void)
int caps; int caps;
int retries = 3; int retries = 3;
int omode = O_WRONLY; int omode = O_WRONLY;
int mmmode = PROT_WRITE;
snd_inited = 0; snd_inited = 0;
@ -115,8 +116,10 @@ SNDDMA_Init (void)
if (snd_device->string[0]) if (snd_device->string[0])
snd_dev = snd_device->string; snd_dev = snd_device->string;
if (snd_oss_rw->int_val) if (snd_oss_rw->int_val) {
omode = O_RDWR; omode = O_RDWR;
mmmode |= PROT_READ;
}
audio_fd = open (snd_dev, omode); audio_fd = open (snd_dev, omode);
if (audio_fd < 0) { // Failed open, retry up to 3 times if (audio_fd < 0) { // Failed open, retry up to 3 times
@ -124,7 +127,7 @@ SNDDMA_Init (void)
while ((audio_fd < 0) && retries-- && while ((audio_fd < 0) && retries-- &&
((errno == EAGAIN) || (errno == EBUSY))) { ((errno == EAGAIN) || (errno == EBUSY))) {
sleep (1); sleep (1);
audio_fd = open (snd_dev, O_RDWR); audio_fd = open (snd_dev, omode);
} }
if (audio_fd < 0) { if (audio_fd < 0) {
perror (snd_dev); perror (snd_dev);
@ -199,7 +202,7 @@ SNDDMA_Init (void)
// memory map the dma buffer // memory map the dma buffer
shm->buffer = (unsigned char *) mmap (NULL, info.fragstotal shm->buffer = (unsigned char *) mmap (NULL, info.fragstotal
* info.fragsize, * info.fragsize,
PROT_READ | PROT_WRITE, mmmode,
MAP_FILE | MAP_SHARED, audio_fd, 0); MAP_FILE | MAP_SHARED, audio_fd, 0);
if (shm->buffer == MAP_FAILED) { if (shm->buffer == MAP_FAILED) {