summaryrefslogtreecommitdiff
path: root/deva/mmap.c
diff options
context:
space:
mode:
authorneal <neal>2005-04-06 16:56:01 +0000
committerneal <neal>2005-04-06 16:56:01 +0000
commit4ac9468fc4925b1f313211ebad92d2c633f60b5e (patch)
tree8571e2c2aa1c13eda045b115a46a3d9f69bdf9ca /deva/mmap.c
parentbf11bbd527b36cca883715231a19d2ece20f17d2 (diff)
deva/
2005-04-06 Neal H. Walfield <neal@gnu.org> * mmap.c: Include <hurd/anonymous.h>. (mmap): Call hurd_anonymous_allocate, not hurd_vm_allocate. (munmap): Call hurd_vm_release, not hurd_vm_deallocate. ruth/ 2005-04-06 Neal H. Walfield <neal@gnu.org> * mmap.c: Include <hurd/anonymous.h>. (mmap): Call hurd_anonymous_allocate, not hurd_vm_allocate. (munmap): Call hurd_vm_release, not hurd_vm_deallocate. task/ 2005-04-06 Neal H. Walfield <neal@gnu.org> * mmap.c: Include <hurd/anonymous.h>. (mmap): Call hurd_anonymous_allocate, not hurd_vm_allocate. (munmap): Call hurd_vm_release, not hurd_vm_deallocate.
Diffstat (limited to 'deva/mmap.c')
-rw-r--r--deva/mmap.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/deva/mmap.c b/deva/mmap.c
index db579e0..cefa158 100644
--- a/deva/mmap.c
+++ b/deva/mmap.c
@@ -25,6 +25,7 @@
#include <sys/mman.h>
#include <errno.h>
+#include <hurd/anonymous.h>
#include <hurd/vm.h>
#include "output.h"
@@ -34,6 +35,7 @@ mmap (void *address, size_t length, int protect, int flags,
int filedes, off_t offset)
{
error_t err;
+ uintptr_t a = (uintptr_t) address;
if (address)
panic ("mmap called with non-zero ADDRESS");
@@ -42,13 +44,14 @@ mmap (void *address, size_t length, int protect, int flags,
if (protect != (PROT_READ | PROT_WRITE))
panic ("mmap called with invalid protection");
- err = hurd_vm_allocate ((uintptr_t *) &address, length, VM_ZEROFILL, 0);
+ err = hurd_anonymous_allocate (&a, length, HURD_ANONYMOUS_ZEROFILL, 0);
if (err)
{
errno = err;
return MAP_FAILED;
}
- return address;
+
+ return (void *) a;
}
int
@@ -59,8 +62,8 @@ munmap (void *addr, size_t length)
/* POSIX says we must round LENGTH up to an even number of pages.
If ADDR is unaligned, that is an error (which hurd_vm_deallocate
will catch). */
- err = hurd_vm_deallocate ((uintptr_t) addr, ((length + getpagesize () - 1)
- & ~(getpagesize () - 1)));
+ err = hurd_vm_release ((uintptr_t) addr, ((length + getpagesize () - 1)
+ & ~(getpagesize () - 1)));
if (err)
{
errno = err;