$NetBSD: patch-af,v 1.3 2016/12/18 22:58:34 adam Exp $ --- src/libout123/xfermem.c.orig 2016-09-26 21:20:25.000000000 +0000 +++ src/libout123/xfermem.c @@ -36,6 +36,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()"); @@ -93,6 +100,10 @@ void xfermem_done (txfermem *xf) Casting to (void*) should silence compilers in case of funny prototype for munmap(). */ 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()");