[pulseaudio-commits] r1783 - in /branches/lennart: configure.ac src/pulsecore/core-util.c src/pulsecore/sound-file-stream.c src/pulsecore/sound-file.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Mon Sep 10 04:35:31 PDT 2007
Author: ossman
Date: Mon Sep 10 13:35:30 2007
New Revision: 1783
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1783&root=pulseaudio&view=rev
Log:
posix_madvise and posix_fadvise aren't present on all systems.
Modified:
branches/lennart/configure.ac
branches/lennart/src/pulsecore/core-util.c
branches/lennart/src/pulsecore/sound-file-stream.c
branches/lennart/src/pulsecore/sound-file.c
Modified: branches/lennart/configure.ac
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/configure.ac?rev=1783&root=pulseaudio&r1=1782&r2=1783&view=diff
==============================================================================
--- branches/lennart/configure.ac (original)
+++ branches/lennart/configure.ac Mon Sep 10 13:35:30 2007
@@ -247,8 +247,8 @@
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 posix_memalign setpgid setsid \
- shm_open sigaction sleep sysconf])
+ getuid inet_ntop inet_pton nanosleep pipe posix_fadvise posix_madvise \
+ posix_memalign setpgid 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")
Modified: branches/lennart/src/pulsecore/core-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/core-util.c?rev=1783&root=pulseaudio&r1=1782&r2=1783&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/core-util.c (original)
+++ branches/lennart/src/pulsecore/core-util.c Mon Sep 10 13:35:30 2007
@@ -1262,11 +1262,13 @@
a = PA_PAGE_ALIGN_PTR(p);
size = (const uint8_t*) p + l - (const uint8_t*) a;
-
+
+#ifdef HAVE_POSIX_MADVISE
if ((r = posix_madvise((void*) a, size, POSIX_MADV_WILLNEED)) == 0) {
pa_log_debug("posix_madvise() worked fine!");
return (void*) p;
}
+#endif
/* Most likely the memory was not mmap()ed from a file and thus
* madvise() didn't work, so let's misuse mlock() do page this
@@ -1279,7 +1281,7 @@
pa_assert_se(getrlimit(RLIMIT_MEMLOCK, &rlim) == 0);
if (rlim.rlim_cur < PA_PAGE_SIZE) {
- pa_log_debug("posix_madvise() failed, resource limits don't allow mlock(), can't page in data: %s", pa_cstrerror(r));
+ pa_log_debug("posix_madvise() failed (or doesn't exist), resource limits don't allow mlock(), can't page in data: %s", pa_cstrerror(r));
return (void*) p;
}
@@ -1288,7 +1290,7 @@
bs = PA_PAGE_SIZE*4;
#endif
- pa_log_debug("posix_madvise() failed, trying mlock(): %s", pa_cstrerror(r));
+ pa_log_debug("posix_madvise() failed (or doesn't exist), trying mlock(): %s", pa_cstrerror(r));
while (size > 0 && bs > 0) {
Modified: branches/lennart/src/pulsecore/sound-file-stream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/sound-file-stream.c?rev=1783&root=pulseaudio&r1=1782&r2=1783&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/sound-file-stream.c (original)
+++ branches/lennart/src/pulsecore/sound-file-stream.c Mon Sep 10 13:35:30 2007
@@ -255,6 +255,7 @@
* file reader into the main event loop and pass the data over the
* asyncmsgq. */
+#ifdef HAVE_POSIX_FADVISE
if (posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL) < 0) {
pa_log_warn("POSIX_FADV_SEQUENTIAL failed: %s", pa_cstrerror(errno));
goto fail;
@@ -266,6 +267,7 @@
goto fail;
} else
pa_log_debug("POSIX_FADV_WILLNEED succeeded.");
+#endif
if (!(u->sndfile = sf_open_fd(fd, SFM_READ, &sfinfo, 1))) {
pa_log("Failed to open file %s", fname);
Modified: branches/lennart/src/pulsecore/sound-file.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/sound-file.c?rev=1783&root=pulseaudio&r1=1782&r2=1783&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/sound-file.c (original)
+++ branches/lennart/src/pulsecore/sound-file.c Mon Sep 10 13:35:30 2007
@@ -67,11 +67,13 @@
goto finish;
}
+#ifdef HAVE_POSIX_FADVISE
if (posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL) < 0) {
pa_log_warn("POSIX_FADV_SEQUENTIAL failed: %s", pa_cstrerror(errno));
goto finish;
} else
pa_log_debug("POSIX_FADV_SEQUENTIAL succeeded.");
+#endif
if (!(sf = sf_open_fd(fd, SFM_READ, &sfinfo, 1))) {
pa_log("Failed to open file %s", fname);
More information about the pulseaudio-commits
mailing list