zsh-workers
 help / color / mirror / code / Atom feed
* use mremap where available
@ 2004-07-16 19:39 Clint Adams
  0 siblings, 0 replies; only message in thread
From: Clint Adams @ 2004-07-16 19:39 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-07-16 19:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-16 19:39 use mremap where available Clint Adams

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).