round the mmap length up to the nearest page size

This commit is contained in:
Bill Currie 2003-04-30 14:55:58 +00:00
parent 95ae17acc1
commit 06608fbf37

View file

@ -264,8 +264,11 @@ SNDDMA_Init (void)
} }
if (mmaped_io) { // memory map the dma buffer if (mmaped_io) { // memory map the dma buffer
shm->buffer = (byte *) mmap (NULL, info.fragstotal * info.fragsize, unsigned long sz = sysconf (_SC_PAGESIZE);
mmmode, mmflags, audio_fd, 0); unsigned long len = info.fragstotal * info.fragsize;
len = (len + sz - 1) & ~(sz - 1);
shm->buffer = (byte *) mmap (NULL, len, mmmode, mmflags, 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);