summaryrefslogtreecommitdiff
path: root/libstore/bunzip2.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1999-07-11 05:30:55 +0000
committerThomas Bushnell <thomas@gnu.org>1999-07-11 05:30:55 +0000
commit344c50cb576d2c3922d90adb8baededc258dd599 (patch)
tree810dc69baf0457d9c69da9cea2017bf23819e656 /libstore/bunzip2.c
parent4e6a0ccbb531ca4bb6cdbd37152f20dbe622e389 (diff)
1999-07-09 Thomas Bushnell, BSG <tb@mit.edu>
* bunzip2.c (bunzip2): Use mmap instead of vm_allocate. * copy.c (copy_read): Likewise. (copy_clone): Likewise. * encode.c (store_encode): Likewise. * gunzip.c (gunzip): Likewise. * rdwr.c (store_read): Likewise. * zero.c (zero_read): Likewise.
Diffstat (limited to 'libstore/bunzip2.c')
-rw-r--r--libstore/bunzip2.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libstore/bunzip2.c b/libstore/bunzip2.c
index 3b7ecb0e..e1ec5808 100644
--- a/libstore/bunzip2.c
+++ b/libstore/bunzip2.c
@@ -135,10 +135,9 @@ bunzip2 (struct store *from, void **buf, size_t *buf_len)
if (zerr)
/* Can't do that, try to make a bigger buffer elsewhere. */
{
- new_buf = old_buf;
- zerr =
- vm_allocate (mach_task_self (),
- (vm_address_t *)&new_buf, new_buf_len, 1);
+ new_buf = mmap (0, new_buf_len, PROT_READ|PROT_WRITE,
+ MAP_ANON, 0, 0);
+ zerr = (new_buf == (void *) -1) ? errno : 0;
if (zerr)
longjmp (zerr_jmp_buf, 1);
@@ -171,7 +170,8 @@ bunzip2 (struct store *from, void **buf, size_t *buf_len)
/* Try to guess a reasonable output buffer size. */
*buf_len = round_page (from->size * 2);
- zerr = vm_allocate (mach_task_self (), (vm_address_t *)buf, *buf_len, 1);
+ *buf = mmap (0, *buf_len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
+ zerr = (*buf == (void *) -1) ? errno : 0;
if (zerr)
return zerr;