aboutsummaryrefslogtreecommitdiff
path: root/libshouldbeinlibc/portxlate.c
diff options
context:
space:
mode:
Diffstat (limited to 'libshouldbeinlibc/portxlate.c')
-rw-r--r--libshouldbeinlibc/portxlate.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/libshouldbeinlibc/portxlate.c b/libshouldbeinlibc/portxlate.c
index 07b2fc03..291bcf3a 100644
--- a/libshouldbeinlibc/portxlate.c
+++ b/libshouldbeinlibc/portxlate.c
@@ -1,8 +1,7 @@
/* Translate mach port names between two tasks
- Copyright (C) 1996 Free Software Foundation, Inc.
-
- Written by Miles Bader <miles@gnu.ai.mit.edu>
+ Copyright (C) 1996,99,2002 Free Software Foundation, Inc.
+ Written by Miles Bader <miles@gnu.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -19,12 +18,14 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <malloc.h>
+#include <sys/types.h>
+#include <sys/mman.h>
#include "portxlate.h"
/* Return a new port name translator translating names between FROM_TASK and
TO_TASK, in XLATOR, or an error. */
-error_t
+error_t
port_name_xlator_create (mach_port_t from_task, mach_port_t to_task,
struct port_name_xlator **xlator)
{
@@ -59,12 +60,10 @@ port_name_xlator_create (mach_port_t from_task, mach_port_t to_task,
}
else
{
- vm_deallocate (mach_task_self (),
- (vm_address_t)x->to_names,
- x->to_names_len * sizeof (mach_port_t));
- vm_deallocate (mach_task_self (),
- (vm_address_t)x->to_types,
- x->to_types_len * sizeof (mach_port_type_t));
+ munmap ((caddr_t) x->to_names,
+ x->to_names_len * sizeof (mach_port_t));
+ munmap ((caddr_t) x->to_types,
+ x->to_types_len * sizeof (mach_port_type_t));
err = ENOMEM;
}
}
@@ -88,12 +87,8 @@ port_name_xlator_free (struct port_name_xlator *x)
mach_port_deallocate (mach_task_self (), x->ports[i]);
free (x->ports);
- vm_deallocate (mach_task_self (),
- (vm_address_t)x->to_names,
- x->to_names_len * sizeof (mach_port_t));
- vm_deallocate (mach_task_self (),
- (vm_address_t)x->to_types,
- x->to_types_len * sizeof (mach_port_type_t));
+ munmap ((caddr_t) x->to_names, x->to_names_len * sizeof (mach_port_t));
+ munmap ((caddr_t) x->to_types, x->to_types_len * sizeof (mach_port_type_t));
mach_port_deallocate (mach_task_self (), x->to_task);
mach_port_deallocate (mach_task_self (), x->from_task);
@@ -112,8 +107,8 @@ port_name_xlator_xlate (struct port_name_xlator *x,
error_t err;
mach_port_t port;
mach_msg_type_number_t i;
- mach_port_type_t aquired_type;
- mach_port_type_t valid_to_types;
+ mach_msg_type_name_t aquired_type;
+ mach_msg_type_name_t valid_to_types;
if (from_type == 0)
{
@@ -130,7 +125,7 @@ port_name_xlator_xlate (struct port_name_xlator *x,
return EKERN_INVALID_RIGHT;
/* Translate the name FROM, in FROM_TASK's namespace into our namespace. */
- err =
+ err =
mach_port_extract_right (x->from_task, from,
((from_type & MACH_PORT_TYPE_RECEIVE)
? MACH_MSG_TYPE_MAKE_SEND