pkgsrc-wip/mpg123/patches/patch-af
Blair Sadewitz 58985cab1b Add sun module, change TODO to start reflecting reality, update distinfos
(I'll kill this redundancy soon), add some patches from pkgsrc.

This really needs testing on other architectures/platforms so we can
decide which patches from audio/mpg123 are actually needed.

Also, I *think* I used the right arguments for madvise(), but I'm
not 100% sure ...

This is definitely faster and more robust than 0.59r; for instance,
It can decode two simultaneous 128kbps stereo streams on a 486DX/133.

I could always use help extending the sun audio module for NetBSD,
too--though it seems to work well enough for starters.
2007-12-28 02:54:36 +00:00

33 lines
1.1 KiB
Text

$NetBSD: patch-af,v 1.3 2007/12/28 02:54:37 bsadewitz Exp $
--- src/xfermem.c.orig 2007-12-26 17:40:51.000000000 -0500
+++ src/xfermem.c
@@ -40,6 +40,13 @@ void xfermem_init (txfermem **xf, size_t
#ifdef HAVE_MMAP
# ifdef MAP_ANON
+
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104030000)
+ if(madvise((void *)xf, (regsize - sizeof(txfermem)),
+ MADV_SEQUENTIAL) < 0)
+ fprintf(stderr,"madvise failed, continuing anyway...\n");
+#endif
+
if ((*xf = (txfermem *) mmap(0, regsize, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_SHARED, -1, 0)) == (txfermem *) -1) {
perror ("mmap()");
@@ -95,7 +102,13 @@ void xfermem_done (txfermem *xf)
if(!xf)
return;
#ifdef HAVE_MMAP
- munmap ((caddr_t) xf, xf->size + xf->metasize + sizeof(txfermem));
+ munmap ((void *) xf, xf->size + xf->metasize + sizeof(txfermem));
+
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104030000)
+ if(madvise((void *)xf, (xf->size + xf->metasize), MADV_FREE) < 0)
+ fprintf(stderr,"madvise failed, continuing anyways..\n");
+#endif
+
#else
if (shmdt((void *) xf) == -1) {
perror ("shmdt()");