fdm: Adjust mremap(2) usage on NetBSD

MREMAP_MAYMOVE flag is the default behaviour on NetBSD and by
adjusting the single mremap() call it can be used on NetBSD too
(remove CONFIGURE_ENV injection kludge).

Thanks to <joerg> and <kamil> respectively for kindly pointing out
that and suggestions! (possible regressions are mine!)
This commit is contained in:
leot 2019-03-18 10:53:40 +00:00
parent f6988b76da
commit d8b9706606
3 changed files with 22 additions and 6 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.13 2019/03/17 21:33:03 leot Exp $
# $NetBSD: Makefile,v 1.14 2019/03/18 10:53:40 leot Exp $
DISTNAME= fdm-2.0
PKGREVISION= 1
PKGREVISION= 2
CATEGORIES= mail
MASTER_SITES= ${MASTER_SITE_GITHUB:=nicm/}
@ -17,9 +17,6 @@ INSTALLATION_DIRS+= ${EGDIR} ${DOCDIR}
EGDIR= ${PREFIX}/share/examples/fdm
DOCDIR= ${PREFIX}/share/doc/fdm
# Avoid mremap(2) due flags not available on NetBSD
CONFIGURE_ENV.NetBSD+= ac_cv_func_mremap=no
CFLAGS.NetBSD+= -D_OPENBSD_SOURCE # needed for strtonum(3)
.include "options.mk"

View file

@ -1,7 +1,8 @@
$NetBSD: distinfo,v 1.11 2019/02/13 11:08:02 leot Exp $
$NetBSD: distinfo,v 1.12 2019/03/18 10:53:40 leot Exp $
SHA1 (fdm-2.0.tar.gz) = 4da70cca5791457489d9e0a018706a6696609eab
RMD160 (fdm-2.0.tar.gz) = b07dc4ee0b8de3362177d74bd935d1ae4dad961d
SHA512 (fdm-2.0.tar.gz) = 9c321dfd200af7b7d396524a43a3ac4b569cddda0a2096122b935e9d7bdb8101f269341fae5bbd4ad8a2947312774da2d49e03eddc67c6ecbce4e1ff9488ebe2
Size (fdm-2.0.tar.gz) = 180662 bytes
SHA1 (patch-Makefile.am) = 2169ebc8e7c920cdf8492ee2039b410f5a6e358c
SHA1 (patch-shm-mmap.c) = d6d961768b60e9174350dc7c6439c2d0be10ae1a

View file

@ -0,0 +1,18 @@
$NetBSD: patch-shm-mmap.c,v 1.1 2019/03/18 10:53:41 leot Exp $
Adjust mremap(2) usage for NetBSD.
--- shm-mmap.c.orig 2019-02-12 22:08:26.000000000 +0000
+++ shm-mmap.c
@@ -218,7 +218,11 @@ shm_resize(struct shm *shm, size_t nmemb
return (NULL);
#ifdef HAVE_MREMAP
+#if defined(__NetBSD__)
+ shm->data = mremap(shm->data, shm->size, NULL, newsize, 0);
+#else
shm->data = mremap(shm->data, shm->size, newsize, MREMAP_MAYMOVE);
+#endif
#else
shm->data = mmap(NULL, newsize, SHM_PROT, SHM_FLAGS, shm->fd, 0);
#endif