Fix detection of shared memory support and proper fallback.

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1316 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Pierre Ossman 2006-08-22 11:41:14 +00:00
parent 568c8ea715
commit 10bbc4b7c9
3 changed files with 31 additions and 10 deletions

View file

@ -27,12 +27,15 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#include <pulsecore/core-error.h>
#include <pulsecore/log.h>
#include <pulsecore/random.h>
@ -51,6 +54,8 @@ static char *segment_name(char *fn, size_t l, unsigned id) {
return fn;
}
#ifdef HAVE_SHM_OPEN
int pa_shm_create_rw(pa_shm *m, size_t size, int shared, mode_t mode) {
char fn[32];
int fd = -1;
@ -239,3 +244,21 @@ fail:
return -1;
}
#else /* HAVE_SHM_OPEN */
int pa_shm_create_rw(pa_shm *m, size_t size, int shared, mode_t mode) {
return -1;
}
void pa_shm_free(pa_shm *m) {
}
void pa_shm_punch(pa_shm *m, size_t offset, size_t size) {
}
int pa_shm_attach_ro(pa_shm *m, unsigned id) {
return -1;
}
#endif /* HAVE_SHM_OPEN */