summaryrefslogtreecommitdiff
path: root/libpager
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-02-12 17:22:30 +0000
committerMiles Bader <miles@gnu.org>1997-02-12 17:22:30 +0000
commit624d5518f780fc0e2c9aac9447948c7e8aee2d51 (patch)
tree68a64060d2c42f70d8b9ab4d6461199f585377e5 /libpager
parenta2d4aba711194d6e264b83209b5562488da65fac (diff)
(pager_get_error):
Deal with _pager_pagemap_resize failing.
Diffstat (limited to 'libpager')
-rw-r--r--libpager/mark-error.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/libpager/mark-error.c b/libpager/mark-error.c
index 411d3a7d..8b031479 100644
--- a/libpager/mark-error.c
+++ b/libpager/mark-error.c
@@ -1,5 +1,5 @@
/* Recording errors for pager library
- Copyright (C) 1994 Free Software Foundation
+ Copyright (C) 1994, 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
@@ -99,16 +99,24 @@ _pager_mark_object_error(struct pager *pager,
/* Tell us what the error (set with mark_object_error) for
pager P is on page ADDR. */
error_t
-pager_get_error (struct pager *p,
- vm_address_t addr)
+pager_get_error (struct pager *p, vm_address_t addr)
{
error_t err;
mutex_lock (&p->interlock);
- _pager_pagemap_resize (p, addr);
-
- err = _pager_page_errors[PM_ERROR(p->pagemap[addr/__vm_page_size])];
+
+ addr /= vm_page_size;
+
+ /* If there really is no error for ADDR, we should be able to exted the
+ pagemap table; otherwise, if some previous operation failed because it
+ couldn't extend the table, this attempt will *probably* (heh) fail for
+ the same reason. */
+ err = _pager_pagemap_resize (p, addr);
+
+ if (! err)
+ err = _pager_page_errors[PM_ERROR(p->pagemap[addr])];
mutex_unlock (&p->interlock);
+
return err;
}