summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-09-10 11:19:00 +0000
committerGerd Moellmann <gerd@gnu.org>2000-09-10 11:19:00 +0000
commit9824c4e39e011a38f5d300d9d932a9b0ce61805e (patch)
tree8a22185f6d263471e34d84bde834caf195037271 /src
parent6a72fdd12eb40f88442576abbc67cfcaa242b701 (diff)
downloademacs-9824c4e39e011a38f5d300d9d932a9b0ce61805e.tar.gz
(mmap_enlarge): Don't return 0 if successful.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/ralloc.c30
2 files changed, 19 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3a175418f4a..3d00ebfeba2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2000-09-10 Gerd Moellmann <gerd@gnu.org>
+
+ * ralloc.c (mmap_enlarge): Don't return 0 if successful.
+
2000-09-09 Ken Raeburn <raeburn@gnu.org>
* s/netbsd.h: Use NOT_C_CODE, not NO_C_SOURCE, when deciding
@@ -6,7 +10,7 @@
2000-09-09 Gerd Moellmann <gerd@gnu.org>
* xfaces.c (CYCLE_CHECK): Don't use the Lisp_Object returned
- by Fmemq in a condition.
+ by Fmemq as a boolean.
2000-09-08 Stefan Monnier <monnier@cs.yale.edu>
diff --git a/src/ralloc.c b/src/ralloc.c
index a90b6514799..9858e45a87e 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -1389,41 +1389,39 @@ mmap_enlarge (r, npages)
{
char *region_end = (char *) r + r->nbytes_mapped;
size_t nbytes;
- int success = 1;
+ int success = 0;
if (npages < 0)
{
/* Unmap pages at the end of the region. */
nbytes = - npages * page_size;
if (munmap (region_end - nbytes, nbytes) == -1)
+ fprintf (stderr, "munmap: %s\n", emacs_strerror (errno));
+ else
{
- fprintf (stderr, "munmap: %s\n", emacs_strerror (errno));
- success = 0;
+ r->nbytes_mapped -= nbytes;
+ success = 1;
}
- else
- r->nbytes_mapped -= nbytes;
}
else if (npages > 0)
{
+ struct mmap_region *r2;
+
nbytes = npages * 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. */
- if (mmap_find (region_end, region_end + nbytes))
- success = 0;
- else
+ r2 = mmap_find (region_end, region_end + nbytes);
+ if (r2 == NULL)
{
POINTER_TYPE *p;
p = mmap (region_end, nbytes, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE | MAP_FIXED, mmap_fd, 0);
if (p == MAP_FAILED)
- {
- fprintf (stderr, "mmap: %s\n", emacs_strerror (errno));
- success = 0;
- }
+ fprintf (stderr, "mmap: %s\n", emacs_strerror (errno));
else if (p != (POINTER_TYPE *) region_end)
{
/* Kernels are free to choose a different address. In
@@ -1431,13 +1429,13 @@ mmap_enlarge (r, npages)
no use for it. */
if (munmap (p, nbytes) == -1)
fprintf (stderr, "munmap: %s\n", emacs_strerror (errno));
- success = 0;
}
else
- r->nbytes_mapped += nbytes;
+ {
+ r->nbytes_mapped += nbytes;
+ success = 1;
+ }
}
-
- success = 0;
}
return success;