implement mach_insert_port_right()

This commit is contained in:
christos 2002-11-19 19:54:07 +00:00
parent 9b7331f3f2
commit 63e4ec4bd7
3 changed files with 52 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mach_namemap.c,v 1.4 2002/11/12 06:14:39 manu Exp $ */
/* $NetBSD: mach_namemap.c,v 1.5 2002/11/19 19:54:07 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.4 2002/11/12 06:14:39 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.5 2002/11/19 19:54:07 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -55,6 +55,7 @@ struct mach_subsystem_namemap mach_namemap[] = {
{ 206, mach_host_get_clock_service, "host_get_clock_service" },
{ 3204, mach_port_allocate, "port_allocate" },
{ 3206, mach_port_deallocate, "port_deallocate" },
{ 3214, mach_port_insert_right, "port_insert_right" },
{ 3404, mach_ports_lookup, "ports_lookup" },
{ 3409, mach_task_get_special_port, "task_get_special_port" },
{ 3801, mach_vm_allocate, "vm_allocate" },

View File

@ -1,4 +1,4 @@
/* $NetBSD: mach_port.c,v 1.5 2002/11/14 21:17:30 christos Exp $ */
/* $NetBSD: mach_port.c,v 1.6 2002/11/19 19:54:07 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mach_port.c,v 1.5 2002/11/14 21:17:30 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: mach_port.c,v 1.6 2002/11/19 19:54:07 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -153,3 +153,31 @@ mach_port_allocate(p, msgh)
return 0;
}
int
mach_port_insert_right(p, msgh)
struct proc *p;
mach_msg_header_t *msgh;
{
mach_port_allocate_request_t req;
mach_port_allocate_reply_t rep;
int error;
if ((error = copyin(msgh, &req, sizeof(req))) != 0)
return error;
DPRINTF(("mach_sys_port_insert_right();\n"));
bzero(&rep, sizeof(rep));
rep.rep_msgh.msgh_bits =
MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE);
rep.rep_msgh.msgh_size = sizeof(rep) - sizeof(rep.rep_trailer);
rep.rep_msgh.msgh_local_port = req.req_msgh.msgh_local_port;
rep.rep_msgh.msgh_id = req.req_msgh.msgh_id + 100;
rep.rep_trailer.msgh_trailer_size = 8;
if ((error = copyout(&rep, msgh, sizeof(rep))) != 0)
return error;
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mach_port.h,v 1.1 2002/11/10 21:53:41 manu Exp $ */
/* $NetBSD: mach_port.h,v 1.2 2002/11/19 19:54:07 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -70,7 +70,25 @@ typedef struct {
mach_msg_trailer_t rep_trailer;
} mach_port_allocate_reply_t;
/* port_insert_right */
typedef struct {
mach_msg_header_t req_msgh;
mach_msg_body_t req_body;
mach_msg_port_descriptor_t req_poly;
mach_ndr_record_t req_ndr;
mach_port_name_t req_name;
} mach_port_insert_right_request_t;
typedef struct {
mach_msg_header_t rep_msgh;
mach_ndr_record_t rep_ndr;
mach_kern_return_t rep_retval;
mach_msg_trailer_t rep_trailer;
} mach_port_insert_right_reply_t;
int mach_port_deallocate __P((struct proc *, mach_msg_header_t *));
int mach_port_allocate __P((struct proc *, mach_msg_header_t *));
int mach_port_insert_right __P((struct proc *, mach_msg_header_t *));
#endif /* _MACH_PORT_H_ */