I don't know why MAP_SHARED is needed, but it's not compatable with

write-only mode, so make it part of snd_oss_rw
This commit is contained in:
Bill Currie 2003-04-30 02:52:41 +00:00
parent 09f3f1ea26
commit 95ae17acc1

View file

@ -120,6 +120,7 @@ SNDDMA_Init (void)
int retries = 3; int retries = 3;
int omode = O_WRONLY; int omode = O_WRONLY;
int mmmode = PROT_WRITE; int mmmode = PROT_WRITE;
int mmflags = MAP_FILE;
struct audio_buf_info info; struct audio_buf_info info;
snd_inited = 0; snd_inited = 0;
@ -132,6 +133,7 @@ SNDDMA_Init (void)
if (snd_oss_rw->int_val) { if (snd_oss_rw->int_val) {
omode = O_RDWR; omode = O_RDWR;
mmmode |= PROT_READ; mmmode |= PROT_READ;
mmflags |= MAP_SHARED;
} }
audio_fd = open (snd_dev, omode); audio_fd = open (snd_dev, omode);
@ -262,9 +264,8 @@ SNDDMA_Init (void)
} }
if (mmaped_io) { // memory map the dma buffer if (mmaped_io) { // memory map the dma buffer
shm->buffer = (unsigned char *) mmap shm->buffer = (byte *) mmap (NULL, info.fragstotal * info.fragsize,
(NULL, info.fragstotal * info.fragsize, mmmode, mmmode, mmflags, audio_fd, 0);
MAP_FILE | MAP_SHARED, audio_fd, 0);
if (shm->buffer == MAP_FAILED) { if (shm->buffer == MAP_FAILED) {
perror (snd_dev); perror (snd_dev);
Sys_Printf ("Could not mmap %s\n", snd_dev); Sys_Printf ("Could not mmap %s\n", snd_dev);