diff options
author | Thomas Bushnell <thomas@gnu.org> | 1999-07-11 05:27:55 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1999-07-11 05:27:55 +0000 |
commit | 8296fd7fe688a203d71c63bdd2fbc4cd098989c1 (patch) | |
tree | 3d2c4db6217702a2fbc39e187aa79b41b74f066f /ftpfs/ccache.c | |
parent | b84e750c4abc10e5e1fb066abf1757b1ea42315e (diff) | |
download | hurd-8296fd7fe688a203d71c63bdd2fbc4cd098989c1.tar.gz hurd-8296fd7fe688a203d71c63bdd2fbc4cd098989c1.tar.bz2 hurd-8296fd7fe688a203d71c63bdd2fbc4cd098989c1.zip |
1999-07-09 Thomas Bushnell, BSG <tb@mit.edu>
* ccache.c (ccache_read): Use mmap instead of vm_allocate.
* netfs.c (get_dirents): Likewise.
Diffstat (limited to 'ftpfs/ccache.c')
-rw-r--r-- | ftpfs/ccache.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/ftpfs/ccache.c b/ftpfs/ccache.c index c1e14a98..56f3bf1e 100644 --- a/ftpfs/ccache.c +++ b/ftpfs/ccache.c @@ -105,8 +105,10 @@ ccache_read (struct ccache *cc, off_t offs, size_t len, void *data) if (cc->alloced == 0) { vm_address_t addr = 0; - err = vm_allocate (mach_task_self (), - &addr, alloc_end, 1); + addr = (vm_address_t) mmap (0, alloc_end, + PROT_READ|PROT_WRITE, + MAP_ANON, 0, 0); + err = (addr == -1) ? errno : 0; if (! err) cc->image = (char *)addr; } @@ -114,6 +116,8 @@ ccache_read (struct ccache *cc, off_t offs, size_t len, void *data) { vm_address_t addr = (vm_address_t)cc->image + cc->alloced; + /* XXX. This can't be replaced with mmap until we + have MAP_EXCL. -tb */ err = vm_allocate (mach_task_self (), &addr, alloc_end - cc->alloced, 0); @@ -121,8 +125,10 @@ ccache_read (struct ccache *cc, off_t offs, size_t len, void *data) /* Gack. We've goota move the whole splooge. */ { addr = 0; - err = vm_allocate (mach_task_self (), - &addr, alloc_end, 1); + addr = (vm_address_t) mmap (0, alloc_end, + PROT_READ|PROT_WRITE, + MAP_ANON, 0, 0); + err = (addr == -1) ? errno : 0; if (! err) /* That worked; copy what's already-fetched. */ { |