pkgsrc/audio/mpg123/patches/patch-al
2001-05-12 20:21:36 +00:00

40 lines
1,006 B
Text

$NetBSD: patch-al,v 1.3 2001/05/12 20:21:37 mycroft Exp $
--- readers.c.orig Thu Mar 4 11:03:49 1999
+++ readers.c Sat May 12 20:09:05 2001
@@ -1,5 +1,9 @@
#include <stdlib.h>
+#ifdef __NetBSD__
+#include <sys/param.h>
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -251,7 +255,12 @@
return -1;
mapend = mapbuf + len;
-
+
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104030000)
+ if(madvise(mapbuf, mapend-mapbuf, MADV_SEQUENTIAL) < 0)
+ fprintf(stderr,"madvise failed, continuing anyways..\n");
+#endif
+
if(param.verbose > 1)
fprintf(stderr,"Using memory mapped IO for this stream.\n");
@@ -268,6 +276,11 @@
static void mapped_close(struct reader *rds)
{
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104030000)
+ if(madvise(mapbuf, mapend-mapbuf, MADV_FREE) < 0)
+ fprintf(stderr,"madvise failed, continuing anyways..\n");
+#endif
+
munmap((void *)mapbuf,mapend-mapbuf);
if (rds->flags & READER_FD_OPENED)
close(rds->filept);