Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
use mremap where available
- X-seq: zsh-workers 20170
- From: Clint Adams <clint@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: use mremap where available
- Date: Fri, 16 Jul 2004 15:39:38 -0400
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
I'm not committing this.
Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.18
diff -u -r1.18 configure.ac
--- configure.ac 8 Jun 2004 13:34:12 -0000 1.18
+++ configure.ac 16 Jul 2004 19:12:28 -0000
@@ -1129,7 +1129,7 @@
AC_FUNC_MMAP
if test x$ac_cv_func_mmap_fixed_mapped = xyes; then
- AC_CHECK_FUNCS(munmap msync)
+ AC_CHECK_FUNCS(munmap msync mremap)
fi
if test $ac_cv_func_setpgrp = yes; then
Index: Src/mem.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/mem.c,v
retrieving revision 1.11
diff -u -r1.11 mem.c
--- Src/mem.c 2 Jun 2004 22:14:26 -0000 1.11
+++ Src/mem.c 16 Jul 2004 19:12:29 -0000
@@ -493,6 +493,13 @@
n -= n % HEAPSIZE;
#ifdef USE_MMAP
+# if defined(HAVE_MREMAP) && defined(MREMAP_MAYMOVE)
+ size_t pgsz = sysconf(_SC_PAGESIZE); /* SVR4 */
+ h = (Heap) mremap(h, h->size, (n + pgsz-1) & ~(pgsz-1), MREMAP_MAYMOVE);
+ if (errno)
+ zwarn("mremap: %e", NULL, errno);
+ DPUTS((h == MAP_FAILED), "BUG: mremap failed");
+# else
{
/*
* I don't know any easy portable way of requesting
@@ -507,6 +514,7 @@
munmap((void *)h, h->size);
h = hnew;
}
+# endif
#else
h = (Heap) realloc(h, n);
#endif
Messages sorted by:
Reverse Date,
Date,
Thread,
Author