]> git.eshelyaron.com Git - emacs.git/commitdiff
(MMAP_ALLOCATED_P): New macro to be set from system
authorGerd Moellmann <gerd@gnu.org>
Tue, 16 Apr 2002 07:35:02 +0000 (07:35 +0000)
committerGerd Moellmann <gerd@gnu.org>
Tue, 16 Apr 2002 07:35:02 +0000 (07:35 +0000)
configuration files.
(mmap_enlarge): Enlarge mapped regions only if MMAP_ALLOCATED_P
returns 0.

src/ChangeLog
src/buffer.c

index 95d035da5cd20939a9a2780f6ca3b2196364a964..c12ce0b8ffad25cbee24249ded761d51b438fff6 100644 (file)
@@ -1,3 +1,10 @@
+2002-04-16  Gerd Moellmann  <gerd@gnu.org>
+
+       * buffer.c (MMAP_ALLOCATED_P): New macro to be set from system
+       configuration files.
+       (mmap_enlarge): Enlarge mapped regions only if MMAP_ALLOCATED_P
+       returns 0.
+
 2002-04-15  Andreas Schwab  <schwab@suse.de>
 
        * config.in: Regenerated using autoheader.
index 5bc8a9ae5478117e1eccedd0bd707a6453c47565..6acb2ae624ab7e88e6400848f7d56e6b51d0ae9f 100644 (file)
@@ -1,5 +1,5 @@
 /* Buffer manipulation primitives for GNU Emacs.
-   Copyright (C) 1985,86,87,88,89,93,94,95,97,98, 1999, 2000, 2001
+   Copyright (C) 1985,86,87,88,89,93,94,95,97,98, 1999, 2000, 2001, 2002
        Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -4343,6 +4343,18 @@ static int mmap_initialized_p;
 
 #define MEM_ALIGN      sizeof (double)
 
+/* Predicate returning true if part of the address range [START ..
+   END[ is currently mapped.  Used to prevent overwriting an existing
+   memory mapping.
+
+   Default is to conservativly assume the address range is occupied by
+   something else.  This can be overridden by system configuration
+   files if system-specific means to determine this exists.  */
+
+#ifndef MMAP_ALLOCATED_P
+#define MMAP_ALLOCATED_P(start, end) 1
+#endif
+
 /* Function prototypes.  */
 
 static int mmap_free_1 P_ ((struct mmap_region *));
@@ -4435,16 +4447,13 @@ mmap_enlarge (r, npages)
     }
   else if (npages > 0)
     {
-      struct mmap_region *r2;
-      
       nbytes = npages * mmap_page_size;
       
       /* Try to map additional pages at the end of the region.  We
         cannot do this if the address range is already occupied by
         something else because mmap deletes any previous mapping.
         I'm not sure this is worth doing, let's see.  */
-      r2 = mmap_find (region_end, region_end + nbytes);
-      if (r2 == NULL)
+      if (!MMAP_ALLOCATED_P (region_end, region_end + nbytes))
        {
          POINTER_TYPE *p;