diff options
author | Thomas Bushnell <thomas@gnu.org> | 1999-07-11 05:28:59 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1999-07-11 05:28:59 +0000 |
commit | ad014b1412367ef9c9038b3b52fa83f6c748e520 (patch) | |
tree | a2b29af6f74fd9c25143180227cd66cb66e4c9d5 /libiohelp | |
parent | a439e9fc84397a7a802b2e9966df6d2bf7a63e73 (diff) |
1999-07-09 Thomas Bushnell, BSG <tb@mit.edu>
* return-buffer.c (iohelp_return_malloced_buffer): Use mmap
instead of vm_allocate.
Diffstat (limited to 'libiohelp')
-rw-r--r-- | libiohelp/ChangeLog | 5 | ||||
-rw-r--r-- | libiohelp/return-buffer.c | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/libiohelp/ChangeLog b/libiohelp/ChangeLog index 0c525328..74cda5d6 100644 --- a/libiohelp/ChangeLog +++ b/libiohelp/ChangeLog @@ -2,6 +2,11 @@ * iouser-reauth.c: Add #include <sys/mman.h> for munmap decl. +1999-07-09 Thomas Bushnell, BSG <tb@mit.edu> + + * return-buffer.c (iohelp_return_malloced_buffer): Use mmap + instead of vm_allocate. + 1999-07-03 Thomas Bushnell, BSG <tb@mit.edu> * iouser-reauth.c (iohelp_reauth): Use munmap instead of diff --git a/libiohelp/return-buffer.c b/libiohelp/return-buffer.c index 22f46e54..83a34299 100644 --- a/libiohelp/return-buffer.c +++ b/libiohelp/return-buffer.c @@ -1,6 +1,6 @@ /* Make a malloced buffer suitable for returning from a mach rpc - Copyright (C) 1996, 1998 Free Software Foundation, Inc. + Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.org> @@ -35,7 +35,10 @@ iohelp_return_malloced_buffer (char *buf, size_t len, error_t err = 0; if (*rlen < len) - err = vm_allocate (mach_task_self (), (vm_address_t *)rbuf, len, 1); + { + *rbuf = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); + err = (*rbuf == (char *) -1) ? errno : 0; + } if (! err) { if (len) |