summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac13
-rw-r--r--src/modules/module-oss-mmap.c3
-rw-r--r--src/pulsecore/shm.c25
3 files changed, 31 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 4aba536d..cb9ca2ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -144,7 +144,7 @@ AC_HEADER_STDC
# POSIX
AC_CHECK_HEADERS([arpa/inet.h glob.h grp.h netdb.h netinet/in.h \
netinet/in_systm.h netinet/ip.h netinet/tcp.h pwd.h sched.h \
- sys/resource.h sys/select.h sys/socket.h sys/wait.h \
+ sys/mman.h sys/resource.h sys/select.h sys/socket.h sys/wait.h \
syslog.h])
AC_CHECK_HEADERS([regex.h], [HAVE_REGEX=1], [HAVE_REGEX=0])
AC_CHECK_HEADERS([sys/un.h], [HAVE_AF_UNIX=1], [HAVE_AF_UNIX=0])
@@ -202,12 +202,11 @@ AC_SEARCH_LIBS([pow], [m])
# POSIX
AC_SEARCH_LIBS([sched_setscheduler], [rt])
AC_SEARCH_LIBS([dlopen], [dl])
+AC_SEARCH_LIBS([shm_open], [rt])
# BSD
AC_SEARCH_LIBS([connect], [socket])
-AC_SEARCH_LIBS([shm_open], [rt])
-
# Non-standard
# This magic is needed so we do not needlessly add static libs to the win32
@@ -221,8 +220,8 @@ AC_FUNC_FORK
AC_FUNC_GETGROUPS
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([chmod chown getaddrinfo getgrgid_r getpwuid_r gettimeofday \
- getuid inet_ntop inet_pton nanosleep pipe setpgid setsid sigaction sleep \
- sysconf])
+ getuid inet_ntop inet_pton nanosleep pipe posix_memalignsetpgid setsid \
+ shm_open sigaction sleep sysconf])
AC_CHECK_FUNCS([mkfifo], [HAVE_MKFIFO=1], [HAVE_MKFIFO=0])
AM_CONDITIONAL(HAVE_MKFIFO, test "x$HAVE_MKFIFO" = "x1")
@@ -243,10 +242,6 @@ AC_CHECK_FUNCS([lstat])
AC_CHECK_FUNCS([setresuid setresgid setreuid setregid seteuid setegid])
-# Memory mangement
-
-AC_CHECK_FUNCS([mmap posix_memalign madvise])
-
#### POSIX threads ####
ACX_PTHREAD
diff --git a/src/modules/module-oss-mmap.c b/src/modules/module-oss-mmap.c
index 0be6bbe2..5ab08287 100644
--- a/src/modules/module-oss-mmap.c
+++ b/src/modules/module-oss-mmap.c
@@ -34,7 +34,10 @@
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
+
+#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
+#endif
#include <pulse/xmalloc.h>
#include <pulse/util.h>
diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c
index 02528126..7c10bd0a 100644
--- a/src/pulsecore/shm.c
+++ b/src/pulsecore/shm.c
@@ -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 */