diff options
author | Thomas Bushnell <thomas@gnu.org> | 1999-07-11 05:32:14 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1999-07-11 05:32:14 +0000 |
commit | cd19ba270757a36b05b776253391debcef50d65c (patch) | |
tree | dcbb0706bad75c4150c2fda310ad1d5bf2733a7d /storeio | |
parent | 787cf415c05ca62623d6e5b0f94ff61c13eb08ad (diff) |
1999-07-09 Thomas Bushnell, BSG <tb@mit.edu>
* dev.c (dev_open): Use mmap instead of vm_allocate.
(dev_read): Likewise.
Diffstat (limited to 'storeio')
-rw-r--r-- | storeio/ChangeLog | 5 | ||||
-rw-r--r-- | storeio/dev.c | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/storeio/ChangeLog b/storeio/ChangeLog index 9a77f0ed..89ad36cc 100644 --- a/storeio/ChangeLog +++ b/storeio/ChangeLog @@ -3,6 +3,11 @@ * dev.c: Add #include <sys/mman.h> for munmap decl. * pager.c: Likewise. +1999-07-09 Thomas Bushnell, BSG <tb@mit.edu> + + * dev.c (dev_open): Use mmap instead of vm_allocate. + (dev_read): Likewise. + 1999-07-03 Thomas Bushnell, BSG <tb@mit.edu> * dev.c (dev_buf_fill): Use munmap instead of vm_deallocate. diff --git a/storeio/dev.c b/storeio/dev.c index 70347c7c..4c7b63da 100644 --- a/storeio/dev.c +++ b/storeio/dev.c @@ -154,8 +154,9 @@ dev_open (struct store_parsed *name, int flags, int inhibit_cache, return err; } - if (vm_allocate (mach_task_self (), - (vm_address_t *)&new->buf, new->store->block_size, 1)) + new->buf = mmap (0, new->store->block_size, PROT_READ|PROT_WRITE, + MAP_ANON, 0, 0); + if (new->buf == (void *) -1) { store_free (new->store); free (new); @@ -373,9 +374,9 @@ dev_read (struct dev *dev, off_t offs, size_t whole_amount, error_t err; if (*len < whole_amount) { - err = vm_allocate (mach_task_self (), - (vm_address_t *)buf, whole_amount, 1); - if (! err) + *buf = mmap (0, whole_amount, PROT_READ|PROT_WRITE, + MAP_ANON, 0, 0); + if (*buf != (void *) -1) allocated_buf = 1; } else |