From cd19ba270757a36b05b776253391debcef50d65c Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Sun, 11 Jul 1999 05:32:14 +0000 Subject: 1999-07-09 Thomas Bushnell, BSG * dev.c (dev_open): Use mmap instead of vm_allocate. (dev_read): Likewise. --- storeio/dev.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'storeio/dev.c') 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 -- cgit v1.2.3