summaryrefslogtreecommitdiff
path: root/libpager
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-02-12 17:22:11 +0000
committerMiles Bader <miles@gnu.org>1997-02-12 17:22:11 +0000
commita2d4aba711194d6e264b83209b5562488da65fac (patch)
treed5d49f30a07cdc96317ac0cf5c69371fa36fd51e /libpager
parent4ef476d9e24d08d53a0f0224095e529248f4eb83 (diff)
(_pager_lock_object):
Deal with _pager_pagemap_resize failing.
Diffstat (limited to 'libpager')
-rw-r--r--libpager/lock-object.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/libpager/lock-object.c b/libpager/lock-object.c
index d2f6da6d..5182eff8 100644
--- a/libpager/lock-object.c
+++ b/libpager/lock-object.c
@@ -1,5 +1,5 @@
/* Synchronous wrapper for memory_object_lock_request
- Copyright (C) 1993, 1994, 1996 Free Software Foundation
+ Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -30,9 +30,8 @@ _pager_lock_object (struct pager *p,
vm_prot_t lock_value,
int sync)
{
- struct lock_request *lr = 0;
- char *pm_entries;
int i;
+ struct lock_request *lr = 0;
mutex_lock (&p->interlock);
if (p->pager_state != NORMAL)
@@ -85,10 +84,20 @@ _pager_lock_object (struct pager *p,
if (should_flush)
{
+ vm_offset_t pm_offs = offset / __vm_page_size;
+
_pager_pagemap_resize (p, offset + size);
- pm_entries = &p->pagemap[offset / __vm_page_size];
- for (i = 0; i < size / vm_page_size; i++)
- pm_entries[i] &= ~PM_INCORE;
+ if (p->pagemapsize > pm_offs)
+ {
+ char *pm_entries = &p->pagemap[pm_offs];
+ vm_offset_t bound = size / vm_page_size;
+
+ if (bound > p->pagemapsize)
+ bound = p->pagemapsize;
+
+ for (i = 0; i < bound; i++)
+ pm_entries[i] &= ~PM_INCORE;
+ }
}
}