diff options
| author | Gerd Moellmann | 2002-04-16 07:35:02 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2002-04-16 07:35:02 +0000 |
| commit | 08327b2269eb0b7c3eb4fc58764a447859ebe400 (patch) | |
| tree | 6807d58b9e91257d740f9d1fe14ef725b82cabdb /src/buffer.c | |
| parent | 144042095648cca17a0a9a105bfd605f82961719 (diff) | |
| download | emacs-08327b2269eb0b7c3eb4fc58764a447859ebe400.tar.gz emacs-08327b2269eb0b7c3eb4fc58764a447859ebe400.zip | |
(MMAP_ALLOCATED_P): New macro to be set from system
configuration files.
(mmap_enlarge): Enlarge mapped regions only if MMAP_ALLOCATED_P
returns 0.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/buffer.c b/src/buffer.c index 5bc8a9ae547..6acb2ae624a 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Buffer manipulation primitives for GNU Emacs. | 1 | /* Buffer manipulation primitives for GNU Emacs. |
| 2 | Copyright (C) 1985,86,87,88,89,93,94,95,97,98, 1999, 2000, 2001 | 2 | Copyright (C) 1985,86,87,88,89,93,94,95,97,98, 1999, 2000, 2001, 2002 |
| 3 | Free Software Foundation, Inc. | 3 | Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| @@ -4343,6 +4343,18 @@ static int mmap_initialized_p; | |||
| 4343 | 4343 | ||
| 4344 | #define MEM_ALIGN sizeof (double) | 4344 | #define MEM_ALIGN sizeof (double) |
| 4345 | 4345 | ||
| 4346 | /* Predicate returning true if part of the address range [START .. | ||
| 4347 | END[ is currently mapped. Used to prevent overwriting an existing | ||
| 4348 | memory mapping. | ||
| 4349 | |||
| 4350 | Default is to conservativly assume the address range is occupied by | ||
| 4351 | something else. This can be overridden by system configuration | ||
| 4352 | files if system-specific means to determine this exists. */ | ||
| 4353 | |||
| 4354 | #ifndef MMAP_ALLOCATED_P | ||
| 4355 | #define MMAP_ALLOCATED_P(start, end) 1 | ||
| 4356 | #endif | ||
| 4357 | |||
| 4346 | /* Function prototypes. */ | 4358 | /* Function prototypes. */ |
| 4347 | 4359 | ||
| 4348 | static int mmap_free_1 P_ ((struct mmap_region *)); | 4360 | static int mmap_free_1 P_ ((struct mmap_region *)); |
| @@ -4435,16 +4447,13 @@ mmap_enlarge (r, npages) | |||
| 4435 | } | 4447 | } |
| 4436 | else if (npages > 0) | 4448 | else if (npages > 0) |
| 4437 | { | 4449 | { |
| 4438 | struct mmap_region *r2; | ||
| 4439 | |||
| 4440 | nbytes = npages * mmap_page_size; | 4450 | nbytes = npages * mmap_page_size; |
| 4441 | 4451 | ||
| 4442 | /* Try to map additional pages at the end of the region. We | 4452 | /* Try to map additional pages at the end of the region. We |
| 4443 | cannot do this if the address range is already occupied by | 4453 | cannot do this if the address range is already occupied by |
| 4444 | something else because mmap deletes any previous mapping. | 4454 | something else because mmap deletes any previous mapping. |
| 4445 | I'm not sure this is worth doing, let's see. */ | 4455 | I'm not sure this is worth doing, let's see. */ |
| 4446 | r2 = mmap_find (region_end, region_end + nbytes); | 4456 | if (!MMAP_ALLOCATED_P (region_end, region_end + nbytes)) |
| 4447 | if (r2 == NULL) | ||
| 4448 | { | 4457 | { |
| 4449 | POINTER_TYPE *p; | 4458 | POINTER_TYPE *p; |
| 4450 | 4459 | ||