From: Erik Walthinsen Date: Wed, 17 Oct 2001 20:57:53 +0000 (+0000) Subject: added another madvise and wrapped them in #ifdef's so they don't break systems withou... X-Git-Tag: BRANCH-BUILD1-ROOT~80 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c352836abea57f019c1af6454990a784cd6bf599;p=platform%2Fupstream%2Fgstreamer.git added another madvise and wrapped them in #ifdef's so they don't break systems without MADV_* Original commit message from CVS: added another madvise and wrapped them in #ifdef's so they don't break systems without MADV_* --- diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index f53548f..8873086 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -360,6 +360,10 @@ gst_filesrc_free_parent_mmap (GstBuffer *buf) } g_mutex_unlock(src->map_regions_lock); +#ifdef MADV_DONTNEED + // madvise to tell the kernel what to do with it + madvise(GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf),MADV_DONTNEED); +#endif // now unmap the memory munmap(GST_BUFFER_DATA(buf),GST_BUFFER_MAXSIZE(buf)); } @@ -384,8 +388,10 @@ gst_filesrc_map_region (GstFileSrc *src, off_t offset, size_t size) g_error ("gstfilesrc mmap(0x%x, %d, 0x%llx) : %s", size, src->fd, offset, sys_errlist[errno]); } +#ifdef MADV_SEQUENTIAL // madvise to tell the kernel what to do with it retval = madvise(GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf),MADV_SEQUENTIAL); +#endif // fill in the rest of the fields GST_BUFFER_FLAGS(buf) = GST_BUFFER_READONLY | GST_BUFFER_ORIGINAL; GST_BUFFER_SIZE(buf) = size; diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index f53548f..8873086 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -360,6 +360,10 @@ gst_filesrc_free_parent_mmap (GstBuffer *buf) } g_mutex_unlock(src->map_regions_lock); +#ifdef MADV_DONTNEED + // madvise to tell the kernel what to do with it + madvise(GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf),MADV_DONTNEED); +#endif // now unmap the memory munmap(GST_BUFFER_DATA(buf),GST_BUFFER_MAXSIZE(buf)); } @@ -384,8 +388,10 @@ gst_filesrc_map_region (GstFileSrc *src, off_t offset, size_t size) g_error ("gstfilesrc mmap(0x%x, %d, 0x%llx) : %s", size, src->fd, offset, sys_errlist[errno]); } +#ifdef MADV_SEQUENTIAL // madvise to tell the kernel what to do with it retval = madvise(GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf),MADV_SEQUENTIAL); +#endif // fill in the rest of the fields GST_BUFFER_FLAGS(buf) = GST_BUFFER_READONLY | GST_BUFFER_ORIGINAL; GST_BUFFER_SIZE(buf) = size;